コード例 #1
0
  /**
   * Updates the group's type settings.
   *
   * @param groupId the primary key of the group
   * @param typeSettings the group's new type settings (optionally <code>null</code>)
   * @return the group
   * @throws PortalException if a portal exception occurred
   */
  @Override
  public Group updateGroup(long groupId, String typeSettings) throws PortalException {

    Group group = groupPersistence.findByPrimaryKey(groupId);

    GroupPermissionUtil.check(getPermissionChecker(), group, ActionKeys.UPDATE);

    if (group.isSite()) {
      Group oldGroup = group;

      UnicodeProperties oldTypeSettingsProperties = oldGroup.getTypeSettingsProperties();

      group = groupLocalService.updateGroup(groupId, typeSettings);

      RatingsDataTransformerUtil.transformGroupRatingsData(
          groupId, oldTypeSettingsProperties, group.getTypeSettingsProperties());

      SiteMembershipPolicyUtil.verifyPolicy(
          group, oldGroup, null, null, null, oldTypeSettingsProperties);

      return group;
    } else {
      return groupLocalService.updateGroup(groupId, typeSettings);
    }
  }
コード例 #2
0
  @Override
  public Group addGroup(
      long parentGroupId,
      long liveGroupId,
      Map<Locale, String> nameMap,
      Map<Locale, String> descriptionMap,
      int type,
      boolean manualMembership,
      int membershipRestriction,
      String friendlyURL,
      boolean site,
      boolean inheritContent,
      boolean active,
      ServiceContext serviceContext)
      throws PortalException {

    if (parentGroupId == GroupConstants.DEFAULT_PARENT_GROUP_ID) {
      PortalPermissionUtil.check(getPermissionChecker(), ActionKeys.ADD_COMMUNITY);
    } else {
      GroupPermissionUtil.check(getPermissionChecker(), parentGroupId, ActionKeys.ADD_COMMUNITY);
    }

    Group group =
        groupLocalService.addGroup(
            getUserId(),
            parentGroupId,
            null,
            0,
            liveGroupId,
            nameMap,
            descriptionMap,
            type,
            manualMembership,
            membershipRestriction,
            friendlyURL,
            site,
            inheritContent,
            active,
            serviceContext);

    if (site) {
      SiteMembershipPolicyUtil.verifyPolicy(group);
    }

    return group;
  }
コード例 #3
0
  @Override
  public Group updateGroup(
      long groupId,
      long parentGroupId,
      Map<Locale, String> nameMap,
      Map<Locale, String> descriptionMap,
      int type,
      boolean manualMembership,
      int membershipRestriction,
      String friendlyURL,
      boolean inheritContent,
      boolean active,
      ServiceContext serviceContext)
      throws PortalException {

    Group group = groupPersistence.findByPrimaryKey(groupId);

    GroupPermissionUtil.check(getPermissionChecker(), group, ActionKeys.UPDATE);

    if (group.getParentGroupId() != parentGroupId) {
      if (parentGroupId == GroupConstants.DEFAULT_PARENT_GROUP_ID) {
        PortalPermissionUtil.check(getPermissionChecker(), ActionKeys.ADD_COMMUNITY);
      } else {
        GroupPermissionUtil.check(getPermissionChecker(), parentGroupId, ActionKeys.ADD_COMMUNITY);
      }
    }

    if (group.isSite()) {
      Group oldGroup = group;

      List<AssetCategory> oldAssetCategories =
          assetCategoryLocalService.getCategories(Group.class.getName(), groupId);

      List<AssetTag> oldAssetTags = assetTagLocalService.getTags(Group.class.getName(), groupId);

      ExpandoBridge oldExpandoBridge = oldGroup.getExpandoBridge();

      Map<String, Serializable> oldExpandoAttributes = oldExpandoBridge.getAttributes();

      group =
          groupLocalService.updateGroup(
              groupId,
              parentGroupId,
              nameMap,
              descriptionMap,
              type,
              manualMembership,
              membershipRestriction,
              friendlyURL,
              inheritContent,
              active,
              serviceContext);

      SiteMembershipPolicyUtil.verifyPolicy(
          group, oldGroup, oldAssetCategories, oldAssetTags, oldExpandoAttributes, null);

      return group;
    } else {
      return groupLocalService.updateGroup(
          groupId,
          parentGroupId,
          nameMap,
          descriptionMap,
          type,
          manualMembership,
          membershipRestriction,
          friendlyURL,
          inheritContent,
          active,
          serviceContext);
    }
  }