mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 13:09:19 +08:00
refactor(auth): 移除平台角色 admin,改为纯 user/super 两级
变更内容:
1. sys_user.role 枚举从 enum('user','admin','super') 改为 enum('user','super')
2. RoleAspect 移除 case "admin" 分支,公司拥有者通过检查 org_company_member.role=owner 获得公司管理员权限
3. PermissionAspect 同样添加 owner 检查逻辑
4. UserMenuServiceImpl 移除 case "admin" 分支
5. AccountServiceImpl/SuperAccountServiceImpl 移除 getRoleName 中的 admin 分支
This commit is contained in:
+21
-5
@@ -60,12 +60,28 @@ public class PermissionAspect {
|
||||
case "super":
|
||||
hasPermission = annotation.allowSuper();
|
||||
break;
|
||||
case "admin":
|
||||
hasPermission = annotation.allowCompany();
|
||||
break;
|
||||
case "user":
|
||||
hasPermission = annotation.allowUser() &&
|
||||
permissionCheckService.hasPermissionByPosition(positionId, annotation.value(), companyId);
|
||||
// 普通用户检查公司成员角色
|
||||
if (annotation.allowCompany()) {
|
||||
try {
|
||||
String memberRole = currentUserContext.getCurrentMemberRole();
|
||||
if ("owner".equals(memberRole)) {
|
||||
hasPermission = true;
|
||||
log.debug("权限验证 - 用户是公司拥有者,视为公司管理员");
|
||||
} else {
|
||||
hasPermission = annotation.allowUser() &&
|
||||
permissionCheckService.hasPermissionByPosition(positionId, annotation.value(), companyId);
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
// 无法获取公司成员角色,降为普通用户权限
|
||||
log.debug("无法获取公司成员角色: {}", e.getMessage());
|
||||
hasPermission = annotation.allowUser() &&
|
||||
permissionCheckService.hasPermissionByPosition(positionId, annotation.value(), companyId);
|
||||
}
|
||||
} else {
|
||||
hasPermission = annotation.allowUser() &&
|
||||
permissionCheckService.hasPermissionByPosition(positionId, annotation.value(), companyId);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new BusinessException("未知的用户角色: " + role);
|
||||
|
||||
@@ -55,9 +55,6 @@ public class RoleAspect {
|
||||
case "super":
|
||||
hasPermission = annotation.allowSuper();
|
||||
break;
|
||||
case "admin":
|
||||
hasPermission = annotation.allowCompany();
|
||||
break;
|
||||
case "user":
|
||||
// 普通用户检查公司成员角色,如果是 owner 则视为公司管理员
|
||||
if (annotation.allowCompany()) {
|
||||
|
||||
Reference in New Issue
Block a user