Пример #1
0
 @RequestMapping("checkname/{type}")
 @ResponseBody
 public String checkName(HttpServletRequest request, String permissionRoleName, String uid) {
   if (uid == null && permissionRoleService.getPermissionRoleByName(permissionRoleName) == null) {
     return "true";
   } else if (uid != null
       && permissionRoleName.equals(
           permissionRoleService.getByUuid(UUID.UUIDFromString(uid)).getPermissionRoleName())) {
     return "true";
   } else if (permissionRoleService.getPermissionRoleByName(permissionRoleName) != null) {
     return "false";
   }
   return "true";
 }
Пример #2
0
 @RequestMapping("change")
 public String changePermissionRole(UUID uuid, Model model) {
   model.addAttribute("model", "permissionrole");
   model.addAttribute("title", "修改权限角色");
   model.addAttribute("titles", new String[] {"权限角色名", "角色描述"});
   model.addAttribute("names", new String[] {"permissionRoleName", "permissionRoleDescribe"});
   model.addAttribute("permissionTree", permissionService.getPermissionTree().toString());
   model.addAttribute("roleDatarangeTree", getRoleDatarangeTree());
   model.addAttribute("permission", permissionRoleService.getPermissions(uuid.toString()));
   model.addAttribute("roleDatarange", permissionRoleService.getRoleDataranges(uuid.toString()));
   PermissionRole r = permissionRoleService.getByUuid(uuid);
   model.addAttribute("entry", r);
   return "user/update-modal";
 }
Пример #3
0
  @RequestMapping("data")
  @ResponseBody
  public String getData(
      HttpServletRequest request,
      HttpServletResponse response,
      PermissionRoleCondition permissionRoleCondition,
      Model model) {
    permissionRoleCondition.setRequest(request);

    PageResult<PermissionRole> pageResult =
        permissionRoleService.queryPage(permissionRoleCondition);

    JSONObject jsonObject2 = new JSONObject();
    JSONArray jsonArray = new JSONArray();

    List<PermissionRole> list = pageResult.getRet();
    for (PermissionRole i : list) {
      JSONObject jsonObject = new JSONObject(i);
      jsonObject.put("date", DateUtils.getDateString(i.getDate()));
      jsonArray.put(jsonObject);
    }

    jsonObject2.put("data", jsonArray);
    jsonObject2.put("iTotalRecords", pageResult.getiTotalRecords());
    jsonObject2.put("iTotalDisplayRecords", pageResult.getiTotalDisplayRecords());
    return jsonObject2.toString();
  }
Пример #4
0
 @RequestMapping("delete")
 @ResponseBody
 public String deletePermissionRole(UUID uuid, Model model) {
   JSONObject jsonObject2 = new JSONObject();
   jsonObject2.put("success", permissionRoleService.deleteById(uuid));
   return jsonObject2.toString();
 }
Пример #5
0
 @RequestMapping("batDelete")
 @ResponseBody
 public String deleteUsers(HttpServletRequest request, Model model) {
   JSONObject jsonObject2 = new JSONObject();
   String[] uuids = request.getParameterValues("uuids[]");
   jsonObject2.put("success", permissionRoleService.batDelete(uuids));
   return jsonObject2.toString();
 }
Пример #6
0
 @RequestMapping("save")
 @ResponseBody
 public String savePermissionRole(
     HttpServletRequest request,
     HttpServletResponse response,
     PermissionRole permissionRole,
     String permissions,
     String roledataranges,
     Model model) {
   permissionRole.setDate(new Date());
   JSONObject jsonObject = new JSONObject();
   jsonObject.put(
       "success",
       permissionRoleService.save(
           permissionRole, permissions.split(","), roledataranges.split(";")));
   return jsonObject.toString();
 }
Пример #7
0
  @RequestMapping("checkAll")
  @ResponseBody
  public String importAllData(
      HttpServletRequest request,
      HttpServletResponse response,
      PermissionRoleCondition condition,
      Model model) {

    JSONObject jsonObject2 = new JSONObject();
    JSONArray jsonArray = new JSONArray(permissionRoleService.getAllPermissionRole(condition));
    //		List<PermissionRole> list = permissionRoleService.getAllPermissionRole();
    //		for (PermissionRole i:list) {
    //			jsonArray.put(i.getUid());
    //		}
    jsonObject2.put("users", jsonArray);
    return jsonObject2.toString();
  }
Пример #8
0
 @RequestMapping("update")
 @ResponseBody
 public String updatePermissionRole(
     HttpServletRequest request,
     HttpServletResponse response,
     PermissionRole permissionRole,
     String permissions,
     String roledataranges,
     Model model) {
   permissionRole.setDate(new Date());
   permissionRole.setUuid(UUID.UUIDFromString(permissionRole.getUid()));
   JSONObject jsonObject2 = new JSONObject();
   jsonObject2.put(
       "success",
       permissionRoleService.update(
           permissionRole, permissions.split(","), roledataranges.split(";")));
   return jsonObject2.toString();
 }