mirror of
https://github.com/yangzongzhuan/RuoYi.git
synced 2026-01-18 08:24:58 +00:00
将isAdmin方法统一到ShiroUtils
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.ShiroUtils;
|
||||
import com.ruoyi.common.xss.Xss;
|
||||
|
||||
/**
|
||||
@@ -123,12 +124,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 ShiroUtils.isAdmin(this.userId);
|
||||
}
|
||||
|
||||
public Long getDeptId()
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.ruoyi.common.exception.file;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 文件上传 误异常类
|
||||
* 文件上传无效扩展名异常类
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
|
||||
@@ -73,6 +73,27 @@ public class ShiroUtils
|
||||
return String.valueOf(getSubject().getSession().getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为管理员
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean isAdmin()
|
||||
{
|
||||
return isAdmin(getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为管理员
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean isAdmin(Long userId)
|
||||
{
|
||||
return userId != null && 1L == userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成随机盐
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user