Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
33b4ba3972 | ||
|
|
7c0f59f731 | ||
|
|
cde1d5eb81 | ||
|
|
8e8b402ced | ||
|
|
fbe9359595 | ||
|
|
c48d18b13f |
@@ -143,7 +143,7 @@ public class SysLoginController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println( MD5.create().digestHex("BMceshi" ));
|
System.out.println( MD5.create().digestHex("BM456" ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ import com.ruoyi.common.core.domain.model.LoginUser;
|
|||||||
import com.ruoyi.common.core.text.Convert;
|
import com.ruoyi.common.core.text.Convert;
|
||||||
import com.ruoyi.common.utils.SecurityUtils;
|
import com.ruoyi.common.utils.SecurityUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.framework.security.context.PermissionContextHolder;
|
import com.ruoyi.framework.security.context.PermissionContextHolder;
|
||||||
|
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||||
import org.aspectj.lang.JoinPoint;
|
import org.aspectj.lang.JoinPoint;
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
import org.aspectj.lang.annotation.Aspect;
|
||||||
import org.aspectj.lang.annotation.Before;
|
import org.aspectj.lang.annotation.Before;
|
||||||
@@ -55,6 +57,14 @@ public class DataScopeAspect
|
|||||||
* 数据权限过滤关键字
|
* 数据权限过滤关键字
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SCOPE = "dataScope";
|
public static final String DATA_SCOPE = "dataScope";
|
||||||
|
private static SysRoleMapper roleMapper;
|
||||||
|
|
||||||
|
|
||||||
|
static {
|
||||||
|
roleMapper= SpringUtils.getBean(SysRoleMapper.class);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Before("@annotation(controllerDataScope)")
|
@Before("@annotation(controllerDataScope)")
|
||||||
public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable
|
public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable
|
||||||
@@ -93,7 +103,9 @@ public class DataScopeAspect
|
|||||||
{
|
{
|
||||||
StringBuilder sqlString = new StringBuilder();
|
StringBuilder sqlString = new StringBuilder();
|
||||||
List<String> conditions = new ArrayList<String>();
|
List<String> conditions = new ArrayList<String>();
|
||||||
|
if(user.getUserId()!=null){
|
||||||
|
user.setRoles(roleMapper.selectRolePermissionByUserId(user.getUserId()));
|
||||||
|
}
|
||||||
for (SysRole role : user.getRoles())
|
for (SysRole role : user.getRoles())
|
||||||
{
|
{
|
||||||
String dataScope = role.getDataScope();
|
String dataScope = role.getDataScope();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ruoyi.framework.web.service;
|
package com.ruoyi.framework.web.service;
|
||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.crypto.digest.MD5;
|
import cn.hutool.crypto.digest.MD5;
|
||||||
import com.ruoyi.common.constant.CacheConstants;
|
import com.ruoyi.common.constant.CacheConstants;
|
||||||
import com.ruoyi.common.constant.Constants;
|
import com.ruoyi.common.constant.Constants;
|
||||||
@@ -250,7 +251,17 @@ public class SysLoginService
|
|||||||
user.setEmail(username);
|
user.setEmail(username);
|
||||||
}
|
}
|
||||||
// 根据角色名查询角色id
|
// 根据角色名查询角色id
|
||||||
Long roleIdByName = roleMapper.selectRoleIdByName(loginBody.getRoleName());
|
String roleName = loginBody.getRoleName();
|
||||||
|
if (StrUtil.isNotEmpty(roleName)){
|
||||||
|
if(roleName.contains("被申请人")){
|
||||||
|
roleName="被申请人操作人";
|
||||||
|
}else if(roleName.contains("申请人")){
|
||||||
|
roleName="申请人操作人";
|
||||||
|
}else if(roleName.contains("委托代理人")){
|
||||||
|
roleName="第三方代理操作人";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Long roleIdByName = roleMapper.selectRoleIdByName(roleName);
|
||||||
if(roleIdByName==null){
|
if(roleIdByName==null){
|
||||||
return AjaxResult.error("角色不存在");
|
return AjaxResult.error("角色不存在");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user