diff --git a/backend/web/server/plugins/aftral-lms/functions.js b/backend/web/server/plugins/aftral-lms/functions.js index e6e819d637..30d39a6f82 100644 --- a/backend/web/server/plugins/aftral-lms/functions.js +++ b/backend/web/server/plugins/aftral-lms/functions.js @@ -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 } diff --git a/backend/web/server/plugins/aftral-lms/user.js b/backend/web/server/plugins/aftral-lms/user.js index 3fbf80db83..ea2a60a038 100644 --- a/backend/web/server/plugins/aftral-lms/user.js +++ b/backend/web/server/plugins/aftral-lms/user.js @@ -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)) }