Ejemplo n.º 1
0
 /**
  * Calculates the grant result for a content
  * @param Content $content The content
  * @param BackendAction $action The action that shall be taken on the content
  * @return GrantResult Returns the calculated grant result
  */
 private function GrantOnContent(Content $content, BackendAction $action)
 {
     if ($this->GetUser()->Equals($content->GetUser())) {
         return GrantResult::Allowed();
     }
     $contentRights = RightsFinder::FindContentRights($content);
     $contentGroup = GroupFinder::FindContentGroup($content);
     if (!$contentRights || !$contentGroup) {
         return GrantResult::NoAccess();
     }
     $groups = $this->GetGroups();
     foreach ($groups as $group) {
         $result = $this->GrantGroupOnContent($group, $contentGroup, $contentRights, $action);
         if ($result->Equals(GrantResult::Allowed())) {
             return $result;
         }
     }
     return GrantResult::NoAccess();
 }