mirror of
https://github.com/yangzongzhuan/RuoYi-Vue.git
synced 2026-01-22 17:45:04 +00:00
将isAdmin方法统一到SecurityUtils
This commit is contained in:
@@ -11,6 +11,7 @@ import com.ruoyi.common.annotation.Excel.ColumnType;
|
||||
import com.ruoyi.common.annotation.Excel.Type;
|
||||
import com.ruoyi.common.annotation.Excels;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.xss.Xss;
|
||||
|
||||
/**
|
||||
@@ -115,12 +116,7 @@ public class SysUser extends BaseEntity
|
||||
|
||||
public boolean isAdmin()
|
||||
{
|
||||
return isAdmin(this.userId);
|
||||
}
|
||||
|
||||
public static boolean isAdmin(Long userId)
|
||||
{
|
||||
return userId != null && 1L == userId;
|
||||
return SecurityUtils.isAdmin(this.userId);
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
|
||||
@@ -114,6 +114,16 @@ public class SecurityUtils
|
||||
return passwordEncoder.matches(rawPassword, encodedPassword);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为管理员
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean isAdmin()
|
||||
{
|
||||
return isAdmin(getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为管理员
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user