Example #1
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 #2
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;
 }