Skip to content
Snippets Groups Projects
Commit 9351fb96 authored by syuilo's avatar syuilo
Browse files

コンディショナルロールもバッジとして表示可能に

parent 7b29e36d
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,15 @@
You should also include the user name that made the change.
-->
## 13.x.x (unreleased)
### Improvements
- コンディショナルロールもバッジとして表示可能に
### Bugfixes
-
## 13.5.6 (2023/02/10)
### Improvements
......
......@@ -211,8 +211,14 @@ export class RoleService implements OnApplicationShutdown {
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;
const badgeCondRoles = roles.filter(r => r.asBadge && (r.target === 'conditional'));
if (badgeCondRoles.length > 0) {
const user = roles.some(r => r.target === 'conditional') ? await this.userCacheService.findById(userId) : null;
const matchedBadgeCondRoles = badgeCondRoles.filter(r => this.evalCond(user!, r.condFormula));
return [...assignedBadgeRoles, ...matchedBadgeCondRoles];
} else {
return assignedBadgeRoles;
}
}
@bindThis
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment