Commit 5b29b1da107432a963b45b34a0d22b9f58a77e5f

Authored by rui.zhang
1 parent 6014aaa972

platform permission

login model move login center

Showing 2 changed files with 16 additions and 3 deletions

platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/DepartmentsController.java View file @ 5b29b1d
... ... @@ -34,6 +34,8 @@
34 34 private UserRoleMapsService userRoleMapsService;
35 35 @Autowired
36 36 private RolePermissionMapsService rolePermissionMapsService;
  37 + @Autowired
  38 + private OrganizationService organizationService;
37 39  
38 40  
39 41  
40 42  
... ... @@ -117,13 +119,14 @@
117 119 @RequestParam(value = "description") String description,
118 120 @RequestParam(value = "shortCode") String shortCode) {
119 121  
  122 + Organization organization = organizationService.getOrganization(orgId);
120 123  
121 124  
122 125 //获取登录用户
123 126 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
124 127 Users users = usersService.getUsersByLoginCenterId(loginState.getId());
125 128  
126   - if (null == name || null == orgId || null == users) {
  129 + if (null == name || null == orgId || null == users || null == organization) {
127 130 ResultUtils.buildParameterErrorResultAndWrite(response);
128 131 return;
129 132 }
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/UsersController.java View file @ 5b29b1d
... ... @@ -26,6 +26,8 @@
26 26 */
27 27 @Controller
28 28 public class UsersController extends BaseController {
  29 + @Autowired
  30 + private DepartmentsService departmentsService;
29 31  
30 32 @Autowired
31 33 private UsersService usersService;
32 34  
... ... @@ -257,10 +259,11 @@
257 259 LoginContext loginState = (LoginContext) request.getAttribute("loginContext");
258 260 Users user = usersService.getUsersByLoginCenterId(loginState.getId());
259 261  
  262 + Departments departments = departmentsService.getDepartments(deptId);
  263 + Organization organization = organizationService.getOrganization(orgId);
260 264  
261 265 if (type == null || StringUtils.isBlank(roleIds) || deptId == null ||
262   - StringUtils.isBlank(name) /*|| StringUtils.isBlank(account) ||
263   - StringUtils.isBlank(pwd) */ || StringUtils.isBlank(phone) || null == user) {
  266 + StringUtils.isBlank(name) || StringUtils.isBlank(phone) || null == user || null == departments || null == organization) {
264 267 ResultUtils.buildParameterErrorResultAndWrite(response);
265 268 return;
266 269 }
... ... @@ -348,6 +351,13 @@
348 351  
349 352  
350 353  
  354 + Departments departments = departmentsService.getDepartments(deptId);
  355 + Organization organization = organizationService.getOrganization(orgId);
  356 +
  357 + if(null == departments || null == organization) {
  358 + ResultUtils.buildParameterErrorResultAndWrite(response);
  359 + return;
  360 + }
351 361  
352 362 //获取登录用户ID
353 363 Integer userId = Integer.valueOf(tokenService.getUserId(token));