|
@@ -2,6 +2,7 @@ package com.ruoyi.common.helper;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.ruoyi.common.constant.UserConstants;
|
|
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
|
import com.ruoyi.common.enums.DeviceType;
|
|
|
import com.ruoyi.common.enums.UserType;
|
|
@@ -12,7 +13,13 @@ import lombok.NoArgsConstructor;
|
|
|
|
|
|
/**
|
|
|
* 登录鉴权助手
|
|
|
- * 为适配多端登录而封装
|
|
|
+ *
|
|
|
+ * user_type 为 用户类型 同一个用户表 可以有多种用户类型 例如 pc,app
|
|
|
+ * deivce 为 设备类型 同一个用户类型 可以有 多种设备类型 例如 web,ios
|
|
|
+ * 可以组成 用户类型与设备类型多对多的 权限灵活控制
|
|
|
+ *
|
|
|
+ * 多用户体系 针对 多种用户类型 但权限控制不一致
|
|
|
+ * 可以组成 多用户类型表与多设备类型 分别控制权限
|
|
|
*
|
|
|
* @author Lion Li
|
|
|
*/
|
|
@@ -26,7 +33,6 @@ public class LoginHelper {
|
|
|
|
|
|
/**
|
|
|
* 登录系统
|
|
|
- * 针对两套用户体系
|
|
|
*
|
|
|
* @param loginUser 登录用户信息
|
|
|
*/
|
|
@@ -38,7 +44,7 @@ public class LoginHelper {
|
|
|
|
|
|
/**
|
|
|
* 登录系统 基于 设备类型
|
|
|
- * 针对一套用户体系
|
|
|
+ * 针对相同用户体系不同设备
|
|
|
*
|
|
|
* @param loginUser 登录用户信息
|
|
|
*/
|
|
@@ -125,12 +131,11 @@ public class LoginHelper {
|
|
|
* @return 结果
|
|
|
*/
|
|
|
public static boolean isAdmin(Long userId) {
|
|
|
- return userId != null && 1L == userId;
|
|
|
+ return UserConstants.ADMIN_ID.equals(userId);
|
|
|
}
|
|
|
|
|
|
public static boolean isAdmin() {
|
|
|
- Long userId = getUserId();
|
|
|
- return userId != null && 1L == userId;
|
|
|
+ return isAdmin(getUserId());
|
|
|
}
|
|
|
|
|
|
}
|