mirror of
https://github.com/strapi/strapi.git
synced 2025-09-15 11:36:17 +00:00
reorganize logic
This commit is contained in:
parent
22c82a7258
commit
e4d1f59b34
@ -76,7 +76,12 @@ const verify = (auth, config) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Custom
|
// Custom
|
||||||
else if (apiToken.type === constants.API_TOKEN_TYPE.CUSTOM && ability) {
|
else if (apiToken.type === constants.API_TOKEN_TYPE.CUSTOM) {
|
||||||
|
if (!ability) {
|
||||||
|
console.log('missing ability');
|
||||||
|
throw new ForbiddenError();
|
||||||
|
}
|
||||||
|
|
||||||
const scopes = castArray(config.scope);
|
const scopes = castArray(config.scope);
|
||||||
|
|
||||||
const isAllowed = scopes.every(scope => ability.can(scope));
|
const isAllowed = scopes.every(scope => ability.can(scope));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user