fix typecheck
This commit is contained in:
parent
e2c9ed355b
commit
9a9692d6d2
|
@ -321,10 +321,10 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
if (ep.meta.requireRolePolicy != null && !user!.isRoot) {
|
||||
const policies = await this.roleService.getUserPolicies(user!.id);
|
||||
let denied: boolean;
|
||||
if (Array.isArray(ep.meta.requireRolePolicy)) {
|
||||
denied = ep.meta.requireRolePolicy.some(policy => !policies[policy]);
|
||||
} else {
|
||||
if (typeof ep.meta.requireRolePolicy === 'string') {
|
||||
denied = !policies[ep.meta.requireRolePolicy];
|
||||
} else {
|
||||
denied = ep.meta.requireRolePolicy.some(policy => !policies[policy]);
|
||||
}
|
||||
if (denied) {
|
||||
throw new ApiError({
|
||||
|
|
Loading…
Reference in a new issue