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) {
|
if (ep.meta.requireRolePolicy != null && !user!.isRoot) {
|
||||||
const policies = await this.roleService.getUserPolicies(user!.id);
|
const policies = await this.roleService.getUserPolicies(user!.id);
|
||||||
let denied: boolean;
|
let denied: boolean;
|
||||||
if (Array.isArray(ep.meta.requireRolePolicy)) {
|
if (typeof ep.meta.requireRolePolicy === 'string') {
|
||||||
denied = ep.meta.requireRolePolicy.some(policy => !policies[policy]);
|
|
||||||
} else {
|
|
||||||
denied = !policies[ep.meta.requireRolePolicy];
|
denied = !policies[ep.meta.requireRolePolicy];
|
||||||
|
} else {
|
||||||
|
denied = ep.meta.requireRolePolicy.some(policy => !policies[policy]);
|
||||||
}
|
}
|
||||||
if (denied) {
|
if (denied) {
|
||||||
throw new ApiError({
|
throw new ApiError({
|
||||||
|
|
Loading…
Reference in a new issue