/**
   * @deprecated As of 6.2.0, replaced by {@link #addLayoutPrototype(Map, String, boolean,
   *     ServiceContext)}
   */
  @Deprecated
  @Override
  public LayoutPrototype addLayoutPrototype(
      Map<Locale, String> nameMap, String description, boolean active)
      throws PortalException, SystemException {

    PortalPermissionUtil.check(getPermissionChecker(), ActionKeys.ADD_LAYOUT_PROTOTYPE);

    User user = getUser();

    return layoutPrototypeLocalService.addLayoutPrototype(
        user.getUserId(), user.getCompanyId(), nameMap, description, active);
  }
  @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;
  }
Exemple #3
0
  protected String getUsersCSV(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    if (!PortalPermissionUtil.contains(permissionChecker, ActionKeys.EXPORT_USER)) {

      return StringPool.BLANK;
    }

    String exportProgressId = ParamUtil.getString(actionRequest, "exportProgressId");

    ProgressTracker progressTracker = new ProgressTracker(actionRequest, exportProgressId);

    progressTracker.start();

    List<User> users = getUsers(actionRequest, actionResponse, themeDisplay);

    int percentage = 10;
    int total = users.size();

    progressTracker.setPercent(percentage);

    if (total == 0) {
      return StringPool.BLANK;
    }

    StringBundler sb = new StringBundler(users.size());

    for (int i = 0; i < users.size(); i++) {
      User user = users.get(i);

      sb.append(getUserCSV(user));

      percentage = Math.min(10 + (i * 90) / total, 99);

      progressTracker.setPercent(percentage);
    }

    progressTracker.finish();

    return sb.toString();
  }
  @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);
    }
  }