2019-06-06 11:59:11 +00:00
|
|
|
module.exports = Self => {
|
|
|
|
/**
|
|
|
|
* Checks if current user has
|
|
|
|
* write privileges over a dms
|
|
|
|
*
|
|
|
|
* @param {Object} ctx - Request context
|
|
|
|
* @param {Interger} id - DmsType id
|
2023-04-19 11:59:26 +00:00
|
|
|
* @param {String} type - Acl accessType
|
2019-11-22 12:46:38 +00:00
|
|
|
* @param {Object} options - Query options
|
2019-06-06 11:59:11 +00:00
|
|
|
* @return {Boolean} True for user with write privileges
|
|
|
|
*/
|
2023-04-19 11:59:26 +00:00
|
|
|
Self.checkRole = async(ctx, id, type, options) => {
|
2019-06-06 11:59:11 +00:00
|
|
|
const models = Self.app.models;
|
2023-04-19 11:59:26 +00:00
|
|
|
const dmsType = await models.DmsType.findById(id, {fields: ['code']}, options);
|
2019-06-06 11:59:11 +00:00
|
|
|
|
2023-04-19 11:59:26 +00:00
|
|
|
return await models.ACL.checkAccessAcl(ctx, 'DmsType', dmsType.code, type);
|
2019-06-06 11:59:11 +00:00
|
|
|
};
|
|
|
|
};
|