/** * 根据用户名查找其权限 * * @param username * @return */ public Set<String> findPermissions(String username) { return userDao.findPermissions(username); }
/** * 根据用户名查找其角色 * * @param username * @return */ public Set<String> findRoles(String username) { return userDao.findRoles(username); }
/** * 根据用户名查找用户 * * @param username * @return */ public User findByUsername(String username) { return userDao.findByUsername(username); }
/** * 移除用户-角色关系 * * @param userId * @param roleIds */ public void uncorrelationRoles(Long userId, Long... roleIds) { userDao.uncorrelationRoles(userId, roleIds); }
/** * 修改密码 * * @param userId * @param newPassword */ public void changePassword(Long userId, String newPassword) { User user = userDao.findOne(userId); user.setPassword(newPassword); passwordHelper.encryptPassword(user); userDao.updateUser(user); }
/** * 创建用户 * * @param user */ public User createUser(User user) { // 加密密码 passwordHelper.encryptPassword(user); return userDao.createUser(user); }