public String outrole(String userId, String roleId, RedirectAttributes redirectAttributes) {
if(Global.isDemoMode()){
addMessage(redirectAttributes, "演示模式,不允许操作!");
return "redirect:"+Global.getAdminPath()+"/sys/role/assign?id="+roleId;
}
Role role = systemService.getRole(roleId);
User user = systemService.getUser(userId);
if (user.equals(UserUtils.getUser())) {
addMessage(redirectAttributes, "无法从角色【" + role.getName() + "】中移除用户【" + user.getName() + "】自己!");
}else {
Boolean flag = systemService.outUserInRole(role, userId);
if (!flag) {
addMessage(redirectAttributes, "用户【" + user.getName() + "】从角色【" + role.getName() + "】中移除失败!");
}else {
addMessage(redirectAttributes, "用户【" + user.getName() + "】从角色【" + role.getName() + "】中移除成功!");
}
}
return "redirect:"+Global.getAdminPath()+"/sys/role/assign?id="+role.getId();
}