Skip to content

Commit

Permalink
feat: 抽象role的权限计算
Browse files Browse the repository at this point in the history
  • Loading branch information
huanmeng-qwq committed Sep 18, 2024
1 parent 33d2798 commit e10f438
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main/java/snw/kookbc/impl/entity/UserImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ public boolean calculateDefaultPerms(Permission permission, Channel channel) {
if (roleIds.isEmpty()) break;
if (roleIds.contains(role.getId())) {
roleIds.remove(role.getId());
if (role.isPermissionSet(permission)) {
if (calculateDefaultPerms(permission, role)) {
return true;
}
}
Expand All @@ -432,6 +432,11 @@ public boolean calculateDefaultPerms(Permission permission, Channel channel) {
return false;
}

public boolean calculateDefaultPerms(Permission permission, Role role) {
return role.isPermissionSet(permission);
}


@Override
public void removeAttachment(PermissionContext context, PermissionAttachment permissionAttachment) {
this.perms.removeAttachment(context, permissionAttachment);
Expand Down

0 comments on commit e10f438

Please sign in to comment.