Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDX-1897: Adjust EDX_ADMIN Permissions #1597

Merged
merged 2 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion backend/src/components/roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const roles = {
//Help functions created in auth module: isValidPenTeamRoleUserToken, isValidPenTeamRoleUser
PenTeamRole: config.get('server:edx:teamRoles:pen'),
//Help functions created in auth module: isValidSchoolMoveUserToken, isValidSchoolMoveUser
School: ['SCHOOL_ADMIN']
School: ['SCHOOL_ADMIN'],
EDX: [config.get('server:edx:roleAdmin')]
},
Admin: {
//Help functions created in auth module: isValidGMPAdmin
Expand Down
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
Loading