check roles

This commit is contained in:
Captain.B 2020-03-02 13:27:46 +08:00
parent 1adbca1582
commit 761dea73aa
2 changed files with 22 additions and 6 deletions

View File

@ -13,12 +13,20 @@
</template> </template>
<script> <script>
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../common/constants";
export default { export default {
name: "MsRecentProject", name: "MsRecentProject",
mounted() { mounted() {
this.$get('/project/recent/5', (response) => { const rolesString = localStorage.getItem("roles");
this.recentProjects = response.data; const roles = rolesString.split(',');
});
if (roles.indexOf(ROLE_TEST_MANAGER) > -1 || roles.indexOf(ROLE_TEST_USER) > -1 || roles.indexOf(ROLE_TEST_VIEWER) > -1) {
this.$get('/project/recent/5', (response) => {
this.recentProjects = response.data;
});
}
}, },
methods: {}, methods: {},
data() { data() {

View File

@ -11,12 +11,20 @@
</template> </template>
<script> <script>
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../common/constants";
export default { export default {
name: "MsRecentTestPlan", name: "MsRecentTestPlan",
mounted() { mounted() {
this.$get('/testplan/recent/5', (response) => { const rolesString = localStorage.getItem("roles");
this.recentTestPlans = response.data; const roles = rolesString.split(',');
});
if (roles.indexOf(ROLE_TEST_MANAGER) > -1 || roles.indexOf(ROLE_TEST_USER) > -1 || roles.indexOf(ROLE_TEST_VIEWER) > -1) {
this.$get('/testplan/recent/5', (response) => {
this.recentTestPlans = response.data;
});
}
}, },
data() { data() {
return { return {