private void _buildGuestGroupBreadcrumb(ThemeDisplay themeDisplay, StringBundler sb)
      throws Exception {
    Group group = GroupLocalServiceUtil.getGroup(themeDisplay.getCompanyId(), GroupConstants.GUEST);

    if (group.getPublicLayoutsPageCount() > 0) {
      LayoutSet layoutSet = LayoutSetLocalServiceUtil.getLayoutSet(group.getGroupId(), false);

      String layoutSetFriendlyURL = PortalUtil.getLayoutSetFriendlyURL(layoutSet, themeDisplay);

      sb.append("<li><span><a href=\"");
      sb.append(layoutSetFriendlyURL);
      sb.append("\">");
      sb.append(HtmlUtil.escape(themeDisplay.getAccount().getName()));
      sb.append("</a></span></li>");
    }
  }
예제 #2
0
  /**
   * Derive default permissions based on the logic found in
   * portal-web/docroot/html/taglib/ui/input_permissions/page.jsp. Do not update this logic updating
   * the logic in the JSP.
   */
  public void deriveDefaultPermissions(long repositoryId, String modelName) throws PortalException {

    long siteGroupId = PortalUtil.getSiteGroupId(repositoryId);

    Group siteGroup = GroupLocalServiceUtil.getGroup(siteGroupId);

    Role defaultGroupRole = RoleLocalServiceUtil.getDefaultGroupRole(siteGroupId);

    List<String> groupPermissions = new ArrayList<String>();
    List<String> guestPermissions = new ArrayList<String>();

    String[] roleNames = {RoleConstants.GUEST, defaultGroupRole.getName()};

    List<String> supportedActions = ResourceActionsUtil.getModelResourceActions(modelName);
    List<String> groupDefaultActions =
        ResourceActionsUtil.getModelResourceGroupDefaultActions(modelName);
    List<String> guestDefaultActions =
        ResourceActionsUtil.getModelResourceGuestDefaultActions(modelName);
    List<String> guestUnsupportedActions =
        ResourceActionsUtil.getModelResourceGuestUnsupportedActions(modelName);

    for (String roleName : roleNames) {
      for (String action : supportedActions) {
        if (roleName.equals(RoleConstants.GUEST)
            && !guestUnsupportedActions.contains(action)
            && guestDefaultActions.contains(action)
            && siteGroup.hasPublicLayouts()) {

          guestPermissions.add(action);
        } else if (roleName.equals(defaultGroupRole.getName())
            && groupDefaultActions.contains(action)) {

          groupPermissions.add(action);
        }
      }
    }

    setGroupPermissions(groupPermissions.toArray(new String[groupPermissions.size()]));
    setGuestPermissions(guestPermissions.toArray(new String[guestPermissions.size()]));
  }
예제 #3
0
 public Group getScopeGroup() throws PortalException {
   return GroupLocalServiceUtil.getGroup(_scopeGroupId);
 }