From 14583a1ddaca57b18a5b8cf5eeaa22624b69dccb Mon Sep 17 00:00:00 2001 From: SodhiA1 <38086281+SodhiA1@users.noreply.github.com> Date: Fri, 20 Oct 2023 11:47:43 -0700 Subject: [PATCH] EDX-1897: Adjust Ministry Permissions --- backend/src/routes/auth.js | 2 +- backend/src/routes/edx-router.js | 17 +++++++++-------- .../components/institute/authority/Details.vue | 2 +- .../components/institute/district/Details.vue | 2 +- frontend/src/components/util/NavBar.vue | 10 +++++----- frontend/src/store/modules/auth.js | 3 ++- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/backend/src/routes/auth.js b/backend/src/routes/auth.js index 5a51d6acc..52cf790c9 100644 --- a/backend/src/routes/auth.js +++ b/backend/src/routes/auth.js @@ -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(); diff --git a/backend/src/routes/edx-router.js b/backend/src/routes/edx-router.js index 6f0d3b0e4..10ce334b1 100644 --- a/backend/src/routes/edx-router.js +++ b/backend/src/routes/edx-router.js @@ -15,15 +15,16 @@ router.get('/users/ministryTeams', passport.authenticate('jwt', {session: false} router.get('/valid-schools-for-messaging', passport.authenticate('jwt', {session: false}, undefined), auth.isValidExchangeUserToken, extendSession, utils.forwardGet('getUserSchools', 'server:edx:rootURL', '/users/user-schools')); router.get('/valid-districts-for-messaging', passport.authenticate('jwt', {session: false}, undefined), auth.isValidExchangeUserToken, extendSession, utils.forwardGet('getUserDistricts', 'server:edx:rootURL', '/users/user-districts')); -router.get('/users/roles', passport.authenticate('jwt', {session: false}, undefined), auth.isValidExchangeUserToken, extendSession, utils.forwardGet('getUserRoles', 'server:edx:rootURL', '/users/roles')); -router.get('/users', passport.authenticate('jwt', {session: false}, undefined), auth.isValidExchangeUserToken, extendSession, getEdxUsers); -router.post('/users/roles/school', passport.authenticate('jwt', {session: false}, undefined), auth.isValidExchangeUserToken, extendSession, updateEdxUserSchoolRoles); -router.post('/users/roles/district', passport.authenticate('jwt', {session: false}, undefined), auth.isValidExchangeUserToken, extendSession, updateEdxUserDistrictRoles); -router.post('/users/remove', passport.authenticate('jwt', {session: false}, undefined), auth.isValidExchangeUserToken, extendSession, removeUserSchoolOrDistrictAccess); -router.post('/users/relink', passport.authenticate('jwt', {session: false}, undefined), auth.isValidExchangeUserToken, extendSession, relinkUserSchoolOrDistrictAccess); -router.get('/users/activation-code/primary/:instituteType/:instituteIdentifier', passport.authenticate('jwt', {session: false}, undefined), auth.isValidExchangeUserToken, extendSession, findPrimaryEdxActivationCode); -router.post('/users/activation-code/primary/:instituteType/:instituteIdentifier', passport.authenticate('jwt', {session: false}, undefined), auth.isValidExchangeUserToken, extendSession, generateOrRegeneratePrimaryEdxActivationCode); +router.get('/users/roles', passport.authenticate('jwt', {session: false}, undefined), auth.isValidEDXUserToken, extendSession, utils.forwardGet('getUserRoles', 'server:edx:rootURL', '/users/roles')); +router.get('/users', passport.authenticate('jwt', {session: false}, undefined), auth.isValidEDXUserToken, extendSession, getEdxUsers); +router.post('/users/roles/school', passport.authenticate('jwt', {session: false}, undefined), auth.isValidEDXUserToken, extendSession, updateEdxUserSchoolRoles); +router.post('/users/roles/district', passport.authenticate('jwt', {session: false}, undefined), auth.isValidEDXUserToken, extendSession, updateEdxUserDistrictRoles); +router.post('/users/remove', passport.authenticate('jwt', {session: false}, undefined), auth.isValidEDXUserToken, extendSession, removeUserSchoolOrDistrictAccess); +router.post('/users/relink', passport.authenticate('jwt', {session: false}, undefined), auth.isValidEDXUserToken, extendSession, relinkUserSchoolOrDistrictAccess); + +router.get('/users/activation-code/primary/:instituteType/:instituteIdentifier', passport.authenticate('jwt', {session: false}, undefined), auth.isValidEDXUserToken, extendSession, findPrimaryEdxActivationCode); +router.post('/users/activation-code/primary/:instituteType/:instituteIdentifier', passport.authenticate('jwt', {session: false}, undefined), auth.isValidEDXUserToken, extendSession, generateOrRegeneratePrimaryEdxActivationCode); //edx exchange routes router.get('/exchange', passport.authenticate('jwt', {session: false}, undefined), auth.isValidExchangeUserToken, extendSession, getExchanges); diff --git a/frontend/src/components/institute/authority/Details.vue b/frontend/src/components/institute/authority/Details.vue index 44c474880..b7f62db2f 100644 --- a/frontend/src/components/institute/authority/Details.vue +++ b/frontend/src/components/institute/authority/Details.vue @@ -452,7 +452,7 @@