mirror of
https://github.com/strapi/strapi.git
synced 2025-07-24 17:40:18 +00:00
Fix feedback PR
This commit is contained in:
parent
b4cae064d5
commit
3da6faac05
@ -18,9 +18,6 @@ module.exports = async (ctx, next) => {
|
||||
}
|
||||
|
||||
const permission = _.get(strapi.plugins['users-permissions'].config, ['roles', role.toString(), 'permissions', route.plugin || 'application', 'controllers', route.controller, route.action]);
|
||||
console.log(permission);
|
||||
console.log('---')
|
||||
console.log(role);
|
||||
|
||||
if (!permission) {
|
||||
return await next();
|
||||
|
@ -14,12 +14,7 @@ const _ = require('lodash');
|
||||
module.exports = {
|
||||
createRole: (role) => {
|
||||
const appRoles = strapi.plugins['users-permissions'].config.roles;
|
||||
const highestId = _.last(Object.keys(appRoles).reduce((acc, key) => {
|
||||
acc.push(_.toNumber(key));
|
||||
|
||||
return acc;
|
||||
}, []).sort()) + 1;
|
||||
|
||||
const highestId = Math.max(...Object.keys(appRoles).map(Number)) + 1;
|
||||
const newRole = _.pick(role, ['name', 'description', 'permissions']);
|
||||
|
||||
_.set(appRoles, highestId.toString(), newRole);
|
||||
|
Loading…
x
Reference in New Issue
Block a user