fix(backend): 管理者権限のロールを持っていても一部のAPIが使用できないことがある問題を修正
This commit is contained in:
parent
e5598da7a2
commit
4a7c6e261a
2 changed files with 3 additions and 1 deletions
|
@ -318,8 +318,9 @@ export class ApiCallService implements OnApplicationShutdown {
|
|||
}
|
||||
|
||||
if (ep.meta.requireRolePolicy != null && !user!.isRoot) {
|
||||
const myRoles = await this.roleService.getUserRoles(user!.id);
|
||||
const policies = await this.roleService.getUserPolicies(user!.id);
|
||||
if (!policies[ep.meta.requireRolePolicy]) {
|
||||
if (!policies[ep.meta.requireRolePolicy] && !myRoles.some(r => r.isAdministrator)) {
|
||||
throw new ApiError({
|
||||
message: 'You are not assigned to a required role.',
|
||||
code: 'ROLE_PERMISSION_DENIED',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue