Beispiel #1
0
  public static void doEditGroup(EditedGroup editedGroup) {

    DabValidators.validateEditedGroup(editedGroup, validation, flash);

    if (Validation.hasErrors()) {
      params.flash();
      Validation.keep();

      flash.put(FLASH_SKIP_LOADING_GROUP, true);
      groupsEdit(flash.get(FLASH_GROUP_ID));
    } else {

      ProjectGroup updated =
          BeanProvider.getGroupService().loadGroupById(flash.get(FLASH_GROUP_ID), false);
      if (updated != null) {

        GroupPep pep = new GroupPep(updated);
        if (pep.isUserAllowedToEditGroup(getSessionWrapper().getLoggedInUserProfileId())) {
          editedGroup.applyToGroup(updated);
          BeanProvider.getGroupService().updateGroupData(updated);
          Utils.waitABit();
        }
      }

      ProfileHome.profileHome();
    }
  }
Beispiel #2
0
  public static void groupsEdit(String gid) {

    // even if we should skip load for edition reason, we still need to load the real group for the
    // security check
    ProjectGroup group = BeanProvider.getGroupService().loadGroupById(gid, false);

    if (group == null || !group.isActive()) {
      // group does not exist!
      Application.index();
    } else {
      GroupPep pep = new GroupPep(group);
      if (!pep.isUserAllowedToEditGroup(getSessionWrapper().getLoggedInUserProfileId())) {
        // user not allowed to edit this group!
        Application.index();
      } else {

        if (!flash.contains(FLASH_SKIP_LOADING_GROUP)) {
          renderArgs.put("editedGroup", new EditedGroup(group));
        }

        Utils.addThemesToRenderArgs(getSessionWrapper(), renderArgs);
        Utils.addJsonThemesToRenderArgs(
            getSessionWrapper(), renderArgs, getSessionWrapper().getSelectedLg());
        flash.put(FLASH_GROUP_ID, gid);
        render();
      }
    }
  }