Package com.ketayao.ketacustom.entity.main

Examples of com.ketayao.ketacustom.entity.main.Role


  @RequestMapping(value="/create/userRole", method={RequestMethod.POST})
  public @ResponseBody void assignRole(UserRole userRole) {
    userRoleService.saveOrUpdate(userRole);
   
    User user = userService.get(userRole.getUser().getId());
    Role role = roleService.get(userRole.getRole().getId());
    LogUitls.putArgs(LogMessageObject.newWrite().setObjects(new Object[]{user.getUsername(), role.getName()}));
  }
View Full Code Here


  @RequestMapping(value="/create/organizationRole", method={RequestMethod.POST})
  public @ResponseBody void assignRole(OrganizationRole organizationRole) {
    organizationRoleService.saveOrUpdate(organizationRole);
   
    Organization organization = organizationService.get(organizationRole.getOrganization().getId());
    Role role = roleService.get(organizationRole.getRole().getId());
    LogUitls.putArgs(LogMessageObject.newWrite().setObjects(new Object[]{organization.getName(), role.getName()}));
  }
View Full Code Here

  }
 
  @RequiresPermissions("Role:edit")
  @RequestMapping(value="/update/{id}", method=RequestMethod.GET)
  public String preUpdate(@PathVariable Long id, Map<String, Object> map) {
    Role role = roleService.get(id);
   
    map.put("module", moduleService.getTree());
    map.put("role", role);
    return UPDATE;
  }
View Full Code Here

 
  @Log(message="修改了{0}角色的信息。")
  @RequiresPermissions("Role:edit")
  @RequestMapping(value="/update", method=RequestMethod.POST)
  public @ResponseBody String update(@Valid Role role) {
    Role oldRole = roleService.get(role.getId());
    oldRole.setName(role.getName());
    oldRole.setDescription(role.getDescription());
   
    List<RolePermission> newRList = new ArrayList<RolePermission>();
    List<RolePermission> delRList = new ArrayList<RolePermission>();
   
    List<RolePermission> hasRolePermissions = rolePermissionService.findByRoleId(role.getId());
    for (RolePermission rolePermission : role.getRolePermissions()) {
      if (rolePermission.getId() == null && rolePermission.getPermission() != null) {
        rolePermission.setRole(oldRole);
        newRList.add(rolePermission);
      } else if (rolePermission.getId() != null && rolePermission.getPermission() == null) {
        for (RolePermission rp : hasRolePermissions) {
          if (rp.getId().equals(rolePermission.getId())) {
            delRList.add(rp);
            break;
          }
        }
      }
    }
   
    rolePermissionService.save(newRList);
    rolePermissionService.delete(delRList);
    roleService.saveOrUpdate(oldRole);
    LogUitls.putArgs(LogMessageObject.newWrite().setObjects(new Object[]{oldRole.getName()}));
    return AjaxObject.newOk("修改角色成功!").toString();
  }
View Full Code Here

 
  @Log(message="删除了{0}角色。")
  @RequiresPermissions("Role:delete")
  @RequestMapping(value="/delete/{id}", method=RequestMethod.POST)
  public @ResponseBody String delete(@PathVariable Long id) {
    Role role = roleService.get(id);
    roleService.delete(role.getId());

    LogUitls.putArgs(LogMessageObject.newWrite().setObjects(new Object[]{role.getName()}));
    return AjaxObject.newOk("删除角色成功!").setCallbackType("").toString();
  }
View Full Code Here

  }
 
  @RequiresPermissions("Role:view")
  @RequestMapping(value="/view/{id}", method={RequestMethod.GET})
  public String view(@PathVariable Long id, Map<String, Object> map) {
    Role role = roleService.get(id);
   
    map.put("module", moduleService.getTree());
    map.put("role", role);
    return VIEW;
  }
View Full Code Here

  }
 
  @RequiresPermissions("Role:assign")
  @RequestMapping(value="/assign/{id}", method=RequestMethod.GET)
  public String preAssign(@PathVariable Long id, Map<String, Object> map) {
    Role role = roleService.get(id);
   
    Map<Module, List<RolePermission>> mpMap = new LinkedHashMap<Module, List<RolePermission>>();
    for (RolePermission rp : role.getRolePermissions()) {
      Module module = rp.getPermission().getModule();
     
      List<RolePermission> rps = mpMap.get(module);
      if (rps == null) {
        rps = new ArrayList<RolePermission>();
View Full Code Here

    }
   
    rolePermissionDataControlService.save(newRList);
    rolePermissionDataControlService.delete(delRList);
   
    Role oldRole = roleService.get(role.getId());
    LogUitls.putArgs(LogMessageObject.newWrite().setObjects(new Object[]{oldRole.getName()}));
    return AjaxObject.newOk("分配数据权限成功!").toString();
  }
View Full Code Here

TOP

Related Classes of com.ketayao.ketacustom.entity.main.Role

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.