add LoginUser添加roleIds字段
This commit is contained in:
@@ -121,4 +121,6 @@ public class LoginUser {
|
||||
*/
|
||||
private String nameWorkNo;
|
||||
|
||||
private String roleIds;
|
||||
|
||||
}
|
||||
|
||||
+8
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.jero.common.api.CommonAPI;
|
||||
import com.jero.common.api.dto.OnlineAuthDTO;
|
||||
import com.jero.common.api.dto.message.*;
|
||||
import com.jero.common.aspect.UrlMatchEnum;
|
||||
@@ -100,6 +101,8 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
private ISysDictService dictService;
|
||||
@Resource
|
||||
private ISysDictItemService sysDictItemService;
|
||||
@Autowired
|
||||
private CommonAPI commonAPI;
|
||||
|
||||
@Autowired
|
||||
ISysCategoryService sysCategoryService;
|
||||
@@ -119,6 +122,11 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
return null;
|
||||
}
|
||||
BeanUtils.copyProperties(sysUser, loginUser);
|
||||
|
||||
// 添加用户角色
|
||||
Set<String> roleSet = commonAPI.queryUserRoles(loginUser.getUsername());
|
||||
loginUser.setRoleIds(StringUtils.join(roleSet, ","));
|
||||
|
||||
return loginUser;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,6 +83,8 @@ public class FieldCommon {
|
||||
public static final String _DICT_TEXT = "_dictText";
|
||||
// 标准拆分单后缀
|
||||
public static final String _STANDARD_SPLIT = "_standardSplit";
|
||||
// 管理员id
|
||||
public static final String ROLE_ADMIN_ID = "f6817f48af4fb3af11b9e8bf182f618b";
|
||||
// 树节点编码
|
||||
public static final String NODE_CODE = "nodeCode";
|
||||
// 中文双引号
|
||||
|
||||
@@ -95,6 +95,7 @@ public class LawsNewsFeed implements Serializable {
|
||||
private java.lang.Integer readCount;
|
||||
/**编辑人*/
|
||||
@ApiModelProperty(value = "编辑人")
|
||||
@Dict(dictTable = "sys_user", dicCode = "id", dicText = "name_work_no")
|
||||
private String writer;
|
||||
|
||||
/**推送范围标识(1-指定用户、2-全体用户)*/
|
||||
|
||||
+4
-2
@@ -3,6 +3,7 @@ package com.jero.modules.laws.standard.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.laws.common.constant.FieldCommon;
|
||||
import com.jero.modules.laws.common.constant.ResultCommon;
|
||||
import com.jero.modules.laws.standard.entity.LawsNewsFeed;
|
||||
import com.jero.modules.laws.standard.entity.LawsPushRange;
|
||||
@@ -93,10 +94,11 @@ public class LawsNewsFeedServiceImpl extends ServiceImpl<LawsNewsFeedMapper, Law
|
||||
// 指定用户可见
|
||||
lawsNewsFeed.setPushRangeFlag(1);
|
||||
}
|
||||
// 判断是否拥有操作权限
|
||||
// 判断是否拥有操作权限(管理员和编辑人拥有权限)
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (StringUtils.isNotBlank(lawsNewsFeed.getWriter())
|
||||
&& !lawsNewsFeed.getWriter().equals(loginUser.getId())) {
|
||||
&& (!lawsNewsFeed.getWriter().equals(loginUser.getId())
|
||||
|| !loginUser.getRoleIds().contains(FieldCommon.ROLE_ADMIN_ID))) {
|
||||
throw new JeroBootException(ResultCommon.NO_PERMISSION);
|
||||
}
|
||||
lawsNewsFeed.setWriter(loginUser.getId());
|
||||
|
||||
Reference in New Issue
Block a user