parent
868c8fffb3
commit
6a3039f7b7
12 changed files with 107 additions and 12 deletions
|
@ -202,6 +202,19 @@ export class RoleService implements OnApplicationShutdown {
|
|||
return [...assignedRoles, ...matchedCondRoles];
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定ユーザーのバッジロール一覧取得
|
||||
*/
|
||||
@bindThis
|
||||
public async getUserBadgeRoles(userId: User['id']) {
|
||||
const assigns = await this.roleAssignmentByUserIdCache.fetch(userId, () => this.roleAssignmentsRepository.findBy({ userId }));
|
||||
const assignedRoleIds = assigns.map(x => x.roleId);
|
||||
const roles = await this.rolesCache.fetch(null, () => this.rolesRepository.findBy({}));
|
||||
const assignedBadgeRoles = roles.filter(r => r.asBadge && assignedRoleIds.includes(r.id));
|
||||
// コンディショナルロールも含めるのは負荷高そうだから一旦無し
|
||||
return assignedBadgeRoles;
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public async getUserPolicies(userId: User['id'] | null): Promise<RolePolicies> {
|
||||
const meta = await this.metaService.fetch();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue