Skip to content

Commit

Permalink
Data permission check.
Browse files Browse the repository at this point in the history
  • Loading branch information
sumathi-thirumani committed Sep 18, 2024
1 parent 7b85f1e commit 1e0ce6a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
13 changes: 11 additions & 2 deletions backend/src/components/permissionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,19 @@ function checkAnyEdxUserSignoffPermission(permissions) {
message: 'User doesn\'t have permission.'
});
}
log.info('proceed to next');
return next();
};
}

function checkPermissionForSignOff(req, res, next) {
if (!req.session.activeInstitutePermissions.includes(req.body.districtSignatoryRole)) {
return res.status(HttpStatus.FORBIDDEN).json({
message: 'User doesn\'t have permission.'
});
}
return next();
}

//Find Institute IDs
function findInstituteInformation_query(req, res, next) {
res.locals.requestedInstituteType = req.query.schoolID ? 'SCHOOL' : 'DISTRICT';
Expand Down Expand Up @@ -591,7 +599,8 @@ const permUtils = {
checkSdcDuplicateAccess,
checkUserAccessToDuplicateSdcSchoolCollections,
checkDistrictBelongsInSdcDistrictCollection,
checkAnyEdxUserSignoffPermission
checkAnyEdxUserSignoffPermission,
checkPermissionForSignOff
};

module.exports = permUtils;
4 changes: 2 additions & 2 deletions backend/src/routes/sdc.js

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

0 comments on commit 1e0ce6a

Please sign in to comment.