public Page getPageFrom(PageKey pageKey) {
   POMSession session = pomManager.getSession();
   final SiteKey siteKey = pageKey.getSite();
   final SiteType siteType = siteKey.getType();
   final String siteName = siteKey.getName();
   Site site = session.getWorkspace().getSite(Mapper.parseSiteType(siteType.getName()), siteName);
   return getPagesFrom(site).getChild(pageKey.getName());
 }
Example #2
0
 public boolean hasEditPermission(PageContext page) {
   PageKey key = page.getKey();
   Identity identity = getIdentity();
   if (SiteType.USER == key.getSite().getType()) {
     return key.getSite().getName().equals(identity.getUserId());
   } else {
     return hasPermission(identity, page.getState().getEditPermission());
   }
 }
Example #3
0
 public boolean hasPermission(PageContext page) {
   PageKey key = page.getKey();
   Identity identity = getIdentity();
   if (SiteType.USER == key.getSite().getType()) {
     if (key.getSite().getName().equals(identity.getUserId())) {
       return true;
     }
   }
   if (superUser_.equals(identity.getUserId())) {
     return true;
   }
   if (hasEditPermission(page)) {
     return true;
   }
   List<String> accessPerms = page.getState().getAccessPermissions();
   if (accessPerms != null) {
     for (String per : accessPerms) {
       if (hasPermission(identity, per)) {
         return true;
       }
     }
   }
   return false;
 }