salix/back/models/dms-type.js

19 lines
637 B
JavaScript
Raw Normal View History

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