Skip to content

Commit

Permalink
EDX-1897: Adjust Ministry Permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
SodhiA1 committed Oct 20, 2023
1 parent ddc28f3 commit 14583a1
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion backend/src/routes/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
validationResult
} = require('express-validator');

const isValidStaffUserWithRoles = auth.isValidUserWithRoles('GMP & UMP & PenRequestBatch & StudentSearch & StaffAdministration & NominalRoll & NominalRollReadOnly & GUMPAnalytics & PenRequestBatchAnalytics & Exchange', [...roles.User.GMP, ...roles.User.UMP, ...roles.User.PenRequestBatch, ...roles.User.StudentSearch, ...roles.User.StaffAdministration, ...roles.User.NominalRoll , ...roles.User.NominalRollReadOnly, ...roles.User.GUMPAnalytics, ...roles.User.PenRequestBatchAnalytics, ...roles.User.Exchange]);
const isValidStaffUserWithRoles = auth.isValidUserWithRoles('GMP & UMP & PenRequestBatch & StudentSearch & StaffAdministration & NominalRoll & NominalRollReadOnly & GUMPAnalytics & PenRequestBatchAnalytics & Exchange & EDX', [...roles.User.GMP, ...roles.User.UMP, ...roles.User.PenRequestBatch, ...roles.User.StudentSearch, ...roles.User.StaffAdministration, ...roles.User.NominalRoll , ...roles.User.NominalRollReadOnly, ...roles.User.GUMPAnalytics, ...roles.User.PenRequestBatchAnalytics, ...roles.User.Exchange, ...roles.User.EDX]);
const isValidWebSocketUserWithRoles = auth.isValidUserWithRoles('GMP & UMP & PenRequestBatch & Exchange & School', [...roles.User.GMP, ...roles.User.UMP, ...roles.User.PenRequestBatch, ...roles.User.Exchange, ...roles.User.School]);

const router = express.Router();
Expand Down
17 changes: 9 additions & 8 deletions backend/src/routes/edx-router.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/src/components/institute/authority/Details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@
</v-row>
<div v-if="!editing">
<v-row
v-if="!hasMailingAddress() && !editing"
v-if="canEditAuthorities() && !hasMailingAddress() && !editing"
no-gutters
class="d-flex justify-start"
>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/institute/district/Details.vue
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@
</v-row>
<div v-if="!editing">
<v-row
v-if="!hasMailingAddress() && !editing"
v-if="canEditDistrictDetails() && !hasMailingAddress() && !editing"
no-gutters
class="mt-2 d-flex justify-start"
>
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/components/util/NavBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export default {
},
computed: {
...mapState(appStore, ['config']),
...mapState(authStore, ['isAuthorizedUser', 'ADVANCED_SEARCH_ROLE', 'VIEW_EDIT_PEN_REQUEST_BATCH_FILES_ROLE', 'EDIT_MACROS_ROLE', 'VIEW_GMP_REQUESTS_ROLE', 'VIEW_UMP_REQUESTS_ROLE', 'PROCESS_STUDENT_ROLE', 'VIEW_PEN_COORDINATOR_INFO_ROLE', 'NOMINAL_ROLL_ROLE', 'STAFF_ADMINISTRATION_ADMIN', 'HAS_STATS_ROLE', 'STUDENT_ANALYTICS_STUDENT_PROFILE', 'STUDENT_ANALYTICS_BATCH', 'EXCHANGE_ROLE', 'EXCHANGE_ACCESS_ROLE', 'PEN_TEAM_ROLE']),
...mapState(authStore, ['isAuthorizedUser', 'ADVANCED_SEARCH_ROLE', 'VIEW_EDIT_PEN_REQUEST_BATCH_FILES_ROLE', 'EDIT_MACROS_ROLE', 'VIEW_GMP_REQUESTS_ROLE', 'VIEW_UMP_REQUESTS_ROLE', 'PROCESS_STUDENT_ROLE', 'VIEW_PEN_COORDINATOR_INFO_ROLE', 'NOMINAL_ROLL_ROLE', 'STAFF_ADMINISTRATION_ADMIN', 'HAS_STATS_ROLE', 'STUDENT_ANALYTICS_STUDENT_PROFILE', 'STUDENT_ANALYTICS_BATCH', 'EXCHANGE_ROLE', 'EXCHANGE_ACCESS_ROLE', 'PEN_TEAM_ROLE', 'INSTITUTIONS_ADMINISTRATION_ADMIN']),
items() {
return [
{
Expand Down Expand Up @@ -254,22 +254,22 @@ export default {
},
{
title: 'Institutions',
authorized: this.isAuthorizedUser,
authorized: this.INSTITUTIONS_ADMINISTRATION_ADMIN,
items: [
{
title: 'Schools',
link: 'instituteSchoolList',
authorized: this.isAuthorizedUser
authorized: this.INSTITUTIONS_ADMINISTRATION_ADMIN
},
{
title: 'Districts',
link: 'instituteDistrict',
authorized: this.isAuthorizedUser
authorized: this.INSTITUTIONS_ADMINISTRATION_ADMIN
},
{
title: 'Authorities',
link: 'instituteAuthoritiesList',
authorized: this.isAuthorizedUser
authorized: this.INSTITUTIONS_ADMINISTRATION_ADMIN
}
],
},
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/store/modules/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ export const authStore = defineStore('auth', {
SCHOOL_ADMIN_ROLE: state => state.isValidSchoolAdmin,
INDEPENDENT_SCHOOLS_ADMIN_ROLE: state => state.isValidSchoolIndependentAdmin,
OFFSHORE_SCHOOLS_ADMIN_ROLE: state => state.isValidSchoolOffshoreAdmin,
INDEPENDENT_AUTHORITY_ADMIN_ROLE: state => state.isValidIndependentAuthorityAdmin
INDEPENDENT_AUTHORITY_ADMIN_ROLE: state => state.isValidIndependentAuthorityAdmin,
INSTITUTIONS_ADMINISTRATION_ADMIN: state => state.isValidSchoolAdmin || state.isValidDistrictAdmin || state.isValidSchoolIndependentAdmin || state.isValidSchoolOffshoreAdmin || state.isValidIndependentAuthorityAdmin,
},
actions: {
//sets Json web token and determines whether user is authenticated
Expand Down

0 comments on commit 14583a1

Please sign in to comment.