allow admin to by pass clerk list filtering
Some checks failed
Build and Push Backend / docker (push) Failing after 5s

This commit is contained in:
irving
2025-11-01 13:28:19 -04:00
parent fb2bd510b1
commit 427ad4b08a
2 changed files with 13 additions and 1 deletions

View File

@@ -135,7 +135,7 @@ public class PlayPersonnelGroupInfoServiceImpl
List<String> idList;
Set<String> roleKeys = loginUser != null && loginUser.getRoles() != null ? loginUser.getRoles()
: Collections.emptySet();
boolean hasOperatorRole = TenantRoleEnum.contains(roleKeys, TenantRoleEnum.OPERATOR);
boolean hasOperatorRole = TenantRoleEnum.hasOperatorPrivilege(roleKeys);
PlayPersonnelGroupInfoEntity groupInfoEntity = null;
if (!hasOperatorRole && loginUser != null) {
groupInfoEntity = this.selectByUserId(loginUser.getUserId());

View File

@@ -14,6 +14,11 @@ public enum TenantRoleEnum {
*/
OPERATOR("operator"),
/**
* 超级管理员角色,与运营角色享有同等权限。
*/
ADMIN("admin"),
/**
* 组长角色,只能查看所在小组的数据。
*/
@@ -50,4 +55,11 @@ public enum TenantRoleEnum {
.map(role -> role.toLowerCase(Locale.ROOT))
.anyMatch(role -> role.equals(targetRole.getRoleKey()));
}
/**
* 是否具备运营权限operator/admin
*/
public static boolean hasOperatorPrivilege(Set<String> roles) {
return contains(roles, OPERATOR) || contains(roles, ADMIN);
}
}