|
|
|
@ -1,21 +1,5 @@ |
|
|
|
package com.ruoyi.web.controller.system; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import org.apache.commons.lang3.ArrayUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.web.bind.annotation.DeleteMapping; |
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.PathVariable; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.PutMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
import com.ruoyi.common.annotation.Log; |
|
|
|
import com.ruoyi.common.core.controller.BaseController; |
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
@ -31,6 +15,16 @@ import com.ruoyi.system.service.ISysDeptService; |
|
|
|
import com.ruoyi.system.service.ISysPostService; |
|
|
|
import com.ruoyi.system.service.ISysRoleService; |
|
|
|
import com.ruoyi.system.service.ISysUserService; |
|
|
|
import org.apache.commons.lang3.ArrayUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.security.access.prepost.PreAuthorize; |
|
|
|
import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* 用户信息 |
|
|
|
@ -111,7 +105,7 @@ public class SysUserController extends BaseController |
|
|
|
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); |
|
|
|
} |
|
|
|
List<SysRole> roles = roleService.selectRoleAll(); |
|
|
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
|
|
|
ajax.put("roles", SecurityUtils.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
|
|
|
ajax.put("posts", postService.selectPostAll()); |
|
|
|
return ajax; |
|
|
|
} |
|
|
|
@ -226,7 +220,7 @@ public class SysUserController extends BaseController |
|
|
|
SysUser user = userService.selectUserById(userId); |
|
|
|
List<SysRole> roles = roleService.selectRolesByUserId(userId); |
|
|
|
ajax.put("user", user); |
|
|
|
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
|
|
|
ajax.put("roles", SecurityUtils.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
|
|
|
return ajax; |
|
|
|
} |
|
|
|
|
|
|
|
|