use of com.github.liuweijw.business.commons.web.aop.PrePermissions in project fw-cloud-framework by liuweijw.
the class MenuController method upd.
@RequestMapping(value = "/upd", method = RequestMethod.POST)
@PrePermissions(value = Functional.UPD)
public R<Boolean> upd(HttpServletRequest request, @RequestBody Menu menu) {
if (null == menu)
return new R<Boolean>().failure("菜单信息为空");
if (null == menu.getPid() || null == menu.getMenuId())
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);
}
use of com.github.liuweijw.business.commons.web.aop.PrePermissions in project fw-cloud-framework by liuweijw.
the class UserController method modify.
/**
* 修改用户密码
*/
@RequestMapping(value = "/modify", method = RequestMethod.POST)
@PrePermissions(value = Functional.UPD)
public R<Boolean> modify(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);
}
Aggregations