示例#1
0
 public boolean hasPermission(Page page) {
   Identity identity = getIdentity();
   if (PortalConfig.USER_TYPE.equals(page.getOwnerType())) {
     if (page.getOwnerId().equals(identity.getUserId())) {
       page.setModifiable(true);
       return true;
     }
   }
   if (superUser_.equals(identity.getUserId())) {
     page.setModifiable(true);
     return true;
   }
   if (hasEditPermission(page)) {
     page.setModifiable(true);
     return true;
   }
   page.setModifiable(false);
   String[] accessPerms = page.getAccessPermissions();
   if (accessPerms != null) {
     for (String per : accessPerms) {
       if (hasPermission(identity, per)) {
         return true;
       }
     }
   }
   return false;
 }
 public Page getPageFrom(org.exoplatform.portal.config.model.Page portalPage) {
   POMSession session = pomManager.getSession();
   Site site =
       session
           .getWorkspace()
           .getSite(Mapper.parseSiteType(portalPage.getOwnerType()), portalPage.getOwnerId());
   return getPagesFrom(site).getChild(portalPage.getName());
 }
示例#3
0
  public void invokeSetBindingBean(Object bean) throws Exception {
    String ownerType = getUIFormSelectBox("ownerType").getValue();
    String ownerId = getUIStringInput("ownerId").getValue();

    // As ownerId is now normalized, we have to maker sure that owenerId of 'group' type starts with
    // a '/'
    if (PortalConfig.GROUP_TYPE.equals(ownerType) && ownerId.charAt(0) != '/') {
      ownerId = "/" + ownerId;
    }

    Page page = (Page) bean;
    page.setPageId(getUIStringInput("pageId").getValue());
    page.setOwnerType(ownerType);
    page.setOwnerId(ownerId);
    page.setName(getUIStringInput("name").getValue());
    String title = getUIStringInput("title").getValue();
    if (title == null || title.trim().length() < 1) title = page.getName();
    page.setTitle(title);

    if (!page.isShowMaxWindow()) {
      page.setShowMaxWindow((Boolean) getUIFormCheckBoxInput("showMaxWindow").getValue());
    }
    if (!PortalConfig.USER_TYPE.equals(page.getOwnerType())) {
      page.setAccessPermissions(
          uiPermissionSetting.getChild(UIListPermissionSelector.class).getValue());
      page.setEditPermission(uiPermissionSetting.getChild(UIPermissionSelector.class).getValue());
    }
    UserACL userACL = getApplicationComponent(UserACL.class);
    userACL.hasPermission(page);

    UIFormInputItemSelector uiTemplate = getChildById("Template");
    if (uiTemplate != null) {
      SelectItemOption<?> itemOption = uiTemplate.getSelectedItemOption();
      if (itemOption != null) {
        page.setFactoryId(itemOption.getIcon());
        //        page.setTemplate((String)itemOption.getValue());
        if (page.getFactoryId().equals(Page.DESKTOP_PAGE)) page.setShowMaxWindow(true);
      }
    }
    UIPageTemplateOptions uiConfigOptions = getChild(UIPageTemplateOptions.class);
    if (uiConfigOptions == null) return;
    Page selectedPage =
        uiConfigOptions.createPageFromSelectedOption(page.getOwnerType(), page.getOwnerId());
    if (selectedPage == null) return;
    page.setChildren(selectedPage.getChildren());
    page.setFactoryId(selectedPage.getFactoryId());
    if (Page.DESKTOP_PAGE.equals(page.getFactoryId())) page.setShowMaxWindow(true);
  }
示例#4
0
 public boolean hasEditPermission(Page page) {
   Identity identity = getIdentity();
   if (PortalConfig.USER_TYPE.equals(page.getOwnerType())) {
     if (page.getOwnerId().equals(identity.getUserId())) {
       page.setModifiable(true);
       return true;
     }
     return false;
   }
   if (hasPermission(identity, page.getEditPermission())) {
     page.setModifiable(true);
     return true;
   }
   page.setModifiable(false);
   return false;
 }
示例#5
0
  public static void toUIPage(UIPage uiPage, Page model) throws Exception {
    toUIContainer(uiPage, model);
    uiPage.setSiteKey(new SiteKey(model.getOwnerType(), model.getOwnerId()));
    uiPage.setIcon(model.getIcon());
    uiPage.setAccessPermissions(model.getAccessPermissions());
    uiPage.setEditPermission(model.getEditPermission());
    uiPage.setFactoryId(model.getFactoryId());
    uiPage.setPageId(model.getPageId());
    uiPage.setTitle(model.getTitle());
    uiPage.setShowMaxWindow(model.isShowMaxWindow());
    uiPage.setModifiable(model.isModifiable());

    List<UIPortlet> portlets = new ArrayList<UIPortlet>();
    uiPage.findComponentOfType(portlets, UIPortlet.class);
    for (UIPortlet portlet : portlets) {
      portlet.setPortletInPortal(false);
    }
  }