Skip to content

Commit

Permalink
Aftral [premieroctet#90] Fix don't filter resources for trainees
Browse files Browse the repository at this point in the history
  • Loading branch information
sebaauvray committed Aug 20, 2024
1 parent a49ebfd commit 454444f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion backend/web/server/plugins/aftral-lms/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ const preprocessGet = async ({model, fields, id, user, params}) => {
fields=[...fields, 'creator']
}
// Full list: only return template blocks not included in sessions
if (!id && model!='session') {
if (!id && model!='session' && user.role==ROLE_CONCEPTEUR) {
params['filter._locked']=false // No session data
params['filter.origin']=null // Templates only
}
Expand Down
2 changes: 1 addition & 1 deletion backend/web/server/plugins/aftral-lms/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const getTraineeCurrentResources = async (userId, params, data, fields) => {
let userCurrentBlockIds=await Progress.find({user: userId, achievement_status: BLOCK_STATUS_CURRENT})
userCurrentBlockIds=userCurrentBlockIds.map(p => p.block._id)
let resources = await loadFromDb({
model: 'resource', fields, params: {'filter._id': {$in: userCurrentBlockIds}}
model: 'resource', fields, params: {'filter._id': {$in: userCurrentBlockIds}}, user: userId,
})
return resources.map(r => new Resource(r))
}
Expand Down

0 comments on commit 454444f

Please sign in to comment.