mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
return permissions with custom token create
This commit is contained in:
parent
e3bd58c69a
commit
895e0c1fe4
@ -100,11 +100,14 @@ const create = async attributes => {
|
||||
|
||||
// If this is a custom type token, create and link the associated permissions
|
||||
if (attributes.type === constants.API_TOKEN_TYPE.CUSTOM) {
|
||||
const permissions = await strapi
|
||||
const permissionsCount = await strapi
|
||||
.query('admin::token-permission')
|
||||
.createMany({ data: attributes.permissions.map(action => ({ action, token: apiToken.id })) });
|
||||
|
||||
Object.assign(result, { permissions });
|
||||
// TODO: should we select the permissions again to ensure it worked?
|
||||
if (permissionsCount) {
|
||||
Object.assign(result, { permissions: attributes.permissions });
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user