System Information
- Strapi Version: 3.6.8
- Operating System:
- Database:
- Node Version: v14.17.6
- NPM Version: 6.14.15
- Yarn Version: 1.22.15
Since you assigned permissions to a role from the code, I need to get all the name fields of the content types like “properties”:{“fields”:[“author”,“category”,“content”,“description”,“image”,“slug”,“title”],“locales”:[“en”]},
(global.strapi.contentTypes) to save {
“action”:“plugins::content-manager.explorer.create”,
“subject”:“application::article.article”,
“properties”:{“fields”:[???],“locales”:[“en”]},
“conditions”:[],
“role”:2
}
const generateRowPermission = (action, subject) => {
return {
action,
subject,
properties: { fields: [‘title’], locales: [‘en’] },
conditions: [],
role: 2
};
};
const actions = [
‘plugins::content-manager.explorer.create’,
‘plugins::content-manager.explorer.delete’,
‘plugins::content-manager.explorer.publish’,
‘plugins::content-manager.explorer.read’,
‘plugins::content-manager.explorer.update’
];
const permission = generateRowPermission(action, value.uid);
await strapi.query(‘permission’, ‘admin’).create(permission);