Skip to content

Commit

Permalink
Fix access permission bug where request would not complete if the
Browse files Browse the repository at this point in the history
a non-logged in user checked ADMIN access to an entity.
  • Loading branch information
Misterblue committed May 31, 2021
1 parent 24e561e commit 6d064b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/route-tools/Permissions.ts
Expand Up @@ -114,7 +114,7 @@ export async function checkAccessToEntity(pAuthToken: AuthToken, // token being
}
else {
// If the authToken is an account, has access if admin
if (SArray.has(pAuthToken.scope, TokenScope.OWNER)) {
if (pAuthToken && SArray.has(pAuthToken.scope, TokenScope.OWNER)) {
Logger.cdebug('field-setting', `checkAccessToEntity: admin. auth.AccountId=${pAuthToken.accountId}`);
requestingAccount = requestingAccount ?? await Accounts.getAccountWithId(pAuthToken.accountId);
canAccess = Accounts.isAdmin(requestingAccount);
Expand Down

0 comments on commit 6d064b7

Please sign in to comment.