支持角色父子继承,允许子角色单独调整自己有的权限

This commit is contained in:
陈博文
2025-06-18 17:57:20 +08:00
parent 6f2d8d51ea
commit 64806dc406
18 changed files with 342 additions and 39 deletions

View File

@@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
* System 错误码枚举类
*
* system 系统,使用 1-002-000-000 段
* @author chenbowen
*/
public interface ErrorCodeConstants {
@@ -33,6 +34,8 @@ public interface ErrorCodeConstants {
ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1_002_002_003, "不能操作类型为系统内置的角色");
ErrorCode ROLE_IS_DISABLE = new ErrorCode(1_002_002_004, "名字为【{}】的角色已被禁用");
ErrorCode ROLE_ADMIN_CODE_ERROR = new ErrorCode(1_002_002_005, "标识【{}】不能使用");
ErrorCode ROLE_CAN_NOT_DELETE_HAS_CHILDREN = new ErrorCode(1_002_002_006, " 角色【{}】存在子角色,不允许删除");
ErrorCode ROLE_PARENT_IS_CHILD = new ErrorCode(1_002_002_007, "不能设置自己的子角色为父角色");
// ========== 用户模块 1-002-003-000 ==========
ErrorCode USER_USERNAME_EXISTS = new ErrorCode(1_002_003_000, "用户账号已经存在");

View File

@@ -5,16 +5,22 @@ import lombok.Getter;
/**
* 登录结果的枚举类
* @author chenbowen
*/
@Getter
@AllArgsConstructor
public enum LoginResultEnum {
SUCCESS(0), // 成功
BAD_CREDENTIALS(10), // 账号或密码不正确
USER_DISABLED(20), // 用户被禁用
CAPTCHA_NOT_FOUND(30), // 图片验证码不存在
CAPTCHA_CODE_ERROR(31), // 图片验证码不正确
// 成功
SUCCESS(0),
// 账号或密码不正确
BAD_CREDENTIALS(10),
// 用户被禁用
USER_DISABLED(20),
// 图片验证码不存在
CAPTCHA_NOT_FOUND(30),
// 图片验证码不正确
CAPTCHA_CODE_ERROR(31),
;

View File

@@ -3,6 +3,10 @@ package cn.iocoder.yudao.module.system.enums.permission;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author chenbowen
*/
@Getter
@AllArgsConstructor
public enum RoleTypeEnum {
@@ -11,10 +15,14 @@ public enum RoleTypeEnum {
* 内置角色
*/
SYSTEM(1),
/**
* 标准角色
*/
NORMAL(2),
/**
* 自定义角色
*/
CUSTOM(2);
CUSTOM(3);
private final Integer type;