Пример #1
0
    private UserGroupRestRep update() {
      UserGroupUpdateParam param = new UserGroupUpdateParam();
      UserGroupRestRep userGroupRestRep = UserGroupUtils.getUserGroup(this.id);

      param.setLabel(userGroupRestRep.getName());
      param.setDomain(this.domain);

      Set<UserAttributeParam> oldAttributes = userGroupRestRep.getAttributes();
      Set<UserAttributeParam> newAttributes = new HashSet<UserAttributeParam>();
      for (AttributeMapping mapping : this.attributes) {
        if (mapping != null) {
          newAttributes.add(mapping.createUserAttributeParam());
        }
      }

      param.getAddAttributes().addAll(newAttributes);
      param.getAddAttributes().removeAll(oldAttributes);

      for (UserAttributeParam oldAttribute : oldAttributes) {
        param.getRemoveAttributes().add(oldAttribute.getKey());
      }

      for (UserAttributeParam newAttribute : newAttributes) {
        param.getRemoveAttributes().remove(newAttribute.getKey());
      }

      return UserGroupUtils.update(this.id, param);
    }
Пример #2
0
  @FlashException("list")
  @Restrictions({@Restrict("SECURITY_ADMIN")})
  public static void edit(String id) {
    UserGroupRestRep userGroup = UserGroupUtils.getUserGroup(id);
    if (userGroup == null) {
      flash.error(MessagesUtils.get(UNKNOWN, id));
      list();
    }

    edit(new UserGroupForm(userGroup));
  }
Пример #3
0
    private UserGroupRestRep create() {
      UserGroupCreateParam param = new UserGroupCreateParam();
      param.setLabel(this.name);
      param.setDomain(this.domain);
      for (AttributeMapping mapping : this.attributes) {
        if (mapping != null) {
          param.getAttributes().add(mapping.createUserAttributeParam());
        }
      }

      return UserGroupUtils.create(param);
    }
Пример #4
0
 public static void listJson() {
   performListJson(UserGroupUtils.getUserGroups(), new JsonItemOperation());
 }
Пример #5
0
 @Override
 public Void performOperation(URI id) throws Exception {
   UserGroupUtils.delete(id);
   return null;
 }