use of com.github.liuweijw.business.commons.web.aop.PrePermissions in project fw-cloud-framework by liuweijw.
the class MenuController method menuTreeList.
// 获取所有菜单列表 以及功能权限
@GetMapping(value = "/menuTreeList/{roleCode}")
@PrePermissions(value = Functional.VIEW)
public R<MenuTreeBean> menuTreeList(@PathVariable("roleCode") String roleCode) {
MenuTreeBean menuTreeBean = new MenuTreeBean();
List<MenuTree> menuTree = menuService.findAllMenuTree();
menuTreeBean.setMenuList(menuTree);
Set<String> permissions = new HashSet<String>();
permissions.addAll(permissionService.findMenuPermissions(roleCode));
menuTreeBean.setPermissions(permissions.toArray(new String[permissions.size()]));
return new R<MenuTreeBean>().data(menuTreeBean);
}
use of com.github.liuweijw.business.commons.web.aop.PrePermissions in project fw-cloud-framework by liuweijw.
the class MenuController method menuTreeList.
// 获取所有菜单列表
@GetMapping(value = "/menuTreeAllList")
@PrePermissions(value = Functional.VIEW)
public R<MenuTreeBean> menuTreeList() {
MenuTreeBean menuTreeBean = new MenuTreeBean();
List<MenuTree> menuTree = menuService.findAllMenuTreeList();
menuTreeBean.setMenuList(menuTree);
return new R<MenuTreeBean>().data(menuTreeBean);
}
use of com.github.liuweijw.business.commons.web.aop.PrePermissions in project fw-cloud-framework by liuweijw.
the class UserController method modifyUser.
/**
* 修改用户密码
*/
@RequestMapping(value = "/modifyUser", method = RequestMethod.POST)
@PrePermissions(value = Functional.UPD)
public R<Boolean> modifyUser(HttpServletRequest request, @RequestBody UserForm userForm) {
if (null == userForm.getUsername())
return new R<Boolean>().failure("用户名不存在");
if (null == userForm.getPassword())
return new R<Boolean>().failure("请输入旧密码");
if (null == userForm.getNewpassword())
return new R<Boolean>().failure("请输入新密码");
User user = this.userService.findUserByUsername(userForm.getUsername().trim(), false);
if (null == user)
return new R<Boolean>().failure("用户名不存在");
if (!new BCryptPasswordEncoder().matches(userForm.getPassword().trim(), user.getPassword()))
return new R<Boolean>().failure("旧密码输入错误!");
user.setPassword(new BCryptPasswordEncoder().encode(userForm.getNewpassword().trim()));
boolean r = this.userService.updateUser(user);
return new R<Boolean>().data(r);
}
use of com.github.liuweijw.business.commons.web.aop.PrePermissions in project fw-cloud-framework by liuweijw.
the class RoleController method add.
@ApiOperation(value = "新增", notes = "角色", produces = "application/json")
@ApiImplicitParam(name = "role", value = "", required = true, dataType = "Role")
@RequestMapping(value = "/add", method = RequestMethod.POST)
@PrePermissions(value = Functional.ADD)
public R<Boolean> add(HttpServletRequest request, @RequestBody Role role) {
if (null == role)
return new R<Boolean>().failure("角色信息为空");
// 检测权限编码是否存在
Role exRole = roleService.findRoleByCode(role.getRoleCode());
if (null != exRole)
return new R<Boolean>().failure("权限编码已经存在!").data(false);
if (null == role.getDeptId())
return new R<Boolean>().failure("请选择角色所属部门");
role.setCreateTime(new Date());
role.setUpdateTime(new Date());
role.setStatu(0);
Role updateObj = roleService.saveRoleAndDept(role);
return new R<Boolean>().data(null != updateObj);
}
use of com.github.liuweijw.business.commons.web.aop.PrePermissions in project fw-cloud-framework by liuweijw.
the class MenuController method add.
@RequestMapping(value = "/add", method = RequestMethod.POST)
@PrePermissions(value = Functional.ADD)
public R<Boolean> add(HttpServletRequest request, @RequestBody Menu menu) {
if (null == menu)
return new R<Boolean>().failure("菜单信息为空");
if (null == menu.getPid())
return new R<Boolean>().failure("请选择菜单再点击进行新增");
menu.setCreateTime(new Date());
menu.setUpdateTime(new Date());
menu.setStatu(0);
Menu menuObj = menuService.saveOrUpdate(menu);
return new R<Boolean>().data(null != menuObj);
}
Aggregations