This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** | |
* `isowner` policy. | |
*/ | |
const pluralize = require('pluralize'); | |
module.exports = async (ctx, next) => { | |
try { | |
const errMsg = 'You are not allowed to perform this action.'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/** | |
* `isCreatedBy` policy. | |
* group `administrator` must be created from interface | |
*/ | |
module.exports = async (ctx, next, args) => { | |
const { id } = ctx.state.user; | |
const role = ctx.state.user.role.type | |
if (role !== "administrator") { |