Skip to content

Commit

Permalink
BC-7522 - fix SHD student visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
virgilchiriac committed Jul 24, 2024
1 parent bb37c71 commit ee3ae6e
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions controllers/schools.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const SCHOOL_FEATURES = [
'rocketChat',
'videoconference',
'messenger',
'studentVisibility',
// 'studentVisibility',
'messengerSchoolRoom',
'oauthProvisioningEnabled',
'showOutdatedUsers',
Expand Down Expand Up @@ -162,6 +162,7 @@ const getCreateHandler = (service) => {

const getUpdateHandler = (service) => {
return function (req, res, next) {

// parse school features
req.body.features = [];
for (let feature of SCHOOL_FEATURES) {
Expand All @@ -171,12 +172,21 @@ const getUpdateHandler = (service) => {
}
}

api(req)
Promise.all([
api(req, { version: 'v3' }).patch(`/school/${req.params.id}`, {
json: {
permissions: {
teacher: {
STUDENT_LIST: !!req.body.hasFeature_studentVisibility
}
}},
}),
api(req)
.patch('/' + service + '/' + req.params.id, {
// TODO: sanitize
json: req.body,
})
.then((data) => {
]).then((data) => {
res.redirect(req.header('Referer'));
})
.catch((err) => {
Expand All @@ -200,6 +210,11 @@ const getDetailHandler = (service) => {
}
}

data.hasFeature_studentVisibility = false;
if (data.permissions && data.permissions.teacher && data.permissions.teacher.STUDENT_LIST) {
data.hasFeature_studentVisibility = true;
}

if (data.county && data.county.name && data.county._id) {
data.county = data.county._id;
}
Expand Down

0 comments on commit ee3ae6e

Please sign in to comment.