mirror of
https://github.com/strapi/strapi.git
synced 2025-09-14 11:08:35 +00:00
reorganize logic
This commit is contained in:
parent
22c82a7258
commit
e4d1f59b34
@ -76,7 +76,12 @@ const verify = (auth, config) => {
|
||||
}
|
||||
|
||||
// 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 isAllowed = scopes.every(scope => ability.can(scope));
|
||||
|
Loading…
x
Reference in New Issue
Block a user