コード例 #1
0
  protected String getGroupURL(
      Group group, PortletRequest portletRequest, boolean includeStagingGroup) {

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

    String groupDisplayURL = group.getDisplayURL(themeDisplay, false);

    if (Validator.isNotNull(groupDisplayURL)) {
      return HttpUtil.removeParameter(groupDisplayURL, "p_p_id");
    }

    groupDisplayURL = group.getDisplayURL(themeDisplay, true);

    if (Validator.isNotNull(groupDisplayURL)) {
      return HttpUtil.removeParameter(groupDisplayURL, "p_p_id");
    }

    if (includeStagingGroup && group.hasStagingGroup()) {
      try {
        if (GroupPermissionUtil.contains(
            themeDisplay.getPermissionChecker(), group, ActionKeys.VIEW_STAGING)) {

          return getGroupURL(group.getStagingGroup(), portletRequest);
        }
      } catch (PortalException pe) {
        _log.error("Unable to check permission on group " + group.getGroupId(), pe);
      }
    }

    return getGroupAdministrationURL(group, portletRequest);
  }
コード例 #2
0
  @Override
  public void deleteMembershipRequests(long groupId, long statusId) throws PortalException {

    GroupPermissionUtil.check(getPermissionChecker(), groupId, ActionKeys.ASSIGN_MEMBERS);

    membershipRequestLocalService.deleteMembershipRequests(groupId, statusId);
  }
コード例 #3
0
  @Override
  public void updateStatus(
      long membershipRequestId, String reviewComments, long statusId, ServiceContext serviceContext)
      throws PortalException {

    MembershipRequest membershipRequest =
        membershipRequestPersistence.findByPrimaryKey(membershipRequestId);

    GroupPermissionUtil.check(
        getPermissionChecker(), membershipRequest.getGroupId(), ActionKeys.ASSIGN_MEMBERS);

    membershipRequestLocalService.updateStatus(
        getUserId(), membershipRequestId, reviewComments, statusId, true, serviceContext);
  }
コード例 #4
0
  protected boolean isFilterManageableGroups(PortletRequest portletRequest) {
    ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    if (permissionChecker.isCompanyAdmin()) {
      return false;
    }

    if (GroupPermissionUtil.contains(permissionChecker, ActionKeys.VIEW)) {
      return false;
    }

    return true;
  }
コード例 #5
0
  protected LinkedHashMap<String, Object> getGroupParams(
      PortletRequest portletRequest, GroupSearchTerms searchTerms, long parentGroupId)
      throws PortalException {

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

    LinkedHashMap<String, Object> groupParams = new LinkedHashMap<>();

    groupParams.put("site", Boolean.TRUE);

    PermissionChecker permissionChecker = themeDisplay.getPermissionChecker();

    User user = themeDisplay.getUser();

    if (searchTerms.hasSearchTerms()) {
      if (isFilterManageableGroups(portletRequest)) {
        groupParams.put("groupsTree", getAllGroups(portletRequest));
      } else if (parentGroupId > 0) {
        List<Group> groupsTree = new ArrayList<>();

        Group parentGroup = _groupLocalService.getGroup(parentGroupId);

        groupsTree.add(parentGroup);

        groupParams.put("groupsTree", groupsTree);
      }

      if (!permissionChecker.isCompanyAdmin()
          && !GroupPermissionUtil.contains(permissionChecker, ActionKeys.VIEW)) {

        groupParams.put("usersGroups", Long.valueOf(user.getUserId()));
      }
    }

    return groupParams;
  }
コード例 #6
0
  protected boolean hasPreviewInDevicePermission(PermissionChecker permissionChecker, Group group)
      throws PortalException {

    return GroupPermissionUtil.contains(permissionChecker, group, ActionKeys.PREVIEW_IN_DEVICE);
  }