权限控制
This commit is contained in:
@@ -140,8 +140,11 @@ public class UserController {
|
|||||||
logService.insertLogWithUserId(user.getId(), user.getTenantId(), "用户",
|
logService.insertLogWithUserId(user.getId(), user.getTenantId(), "用户",
|
||||||
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_LOGIN).append(user.getLoginName()).toString(),
|
new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_LOGIN).append(user.getLoginName()).toString(),
|
||||||
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
|
||||||
|
JSONArray btnStrArr = userService.getBtnStrArrById(user.getId());
|
||||||
data.put("token", token);
|
data.put("token", token);
|
||||||
data.put("user", user);
|
data.put("user", user);
|
||||||
|
//用户的按钮权限
|
||||||
|
data.put("userBtn", btnStrArr);
|
||||||
}
|
}
|
||||||
res.code = 200;
|
res.code = 200;
|
||||||
res.data = data;
|
res.data = data;
|
||||||
|
|||||||
@@ -754,4 +754,29 @@ public class UserService {
|
|||||||
}
|
}
|
||||||
return userId;
|
return userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户的按钮权限
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public JSONArray getBtnStrArrById(Long userId) throws Exception {
|
||||||
|
JSONArray btnStrArr = new JSONArray();
|
||||||
|
List<UserBusiness> userRoleList = userBusinessService.getBasicData(userId.toString(), "UserRole");
|
||||||
|
if(userRoleList!=null && userRoleList.size()>0) {
|
||||||
|
String roleValue = userRoleList.get(0).getValue();
|
||||||
|
if(StringUtil.isNotEmpty(roleValue) && roleValue.indexOf("[")>-1 && roleValue.indexOf("]")>-1){
|
||||||
|
roleValue = roleValue.replace("[", "").replace("]", ""); //角色id-单个
|
||||||
|
List<UserBusiness> roleFunctionsList = userBusinessService.getBasicData(roleValue, "RoleFunctions");
|
||||||
|
if(roleFunctionsList!=null && roleFunctionsList.size()>0) {
|
||||||
|
String btnStr = roleFunctionsList.get(0).getBtnStr();
|
||||||
|
if(StringUtil.isNotEmpty(btnStr)){
|
||||||
|
btnStrArr = JSONArray.parseArray(btnStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return btnStrArr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user