fix typecheck

This commit is contained in:
riku6460 2023-09-29 23:58:27 +09:00
parent e2c9ed355b
commit 9a9692d6d2
No known key found for this signature in database
GPG key ID: 27414FA27DB94CF6

View file

@ -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({