/** * Finds the content rigths by searching in element tree * @param Content $content The content * @return BackendContentRights The rights of the contents */ static function FindContentRights(Content $content) { $result = null; $currContent = $content; do { $result = $currContent->GetUserGroupRights(); $currContent = ContentTreeUtil::ParentOf($currContent); } while (!$result && $currContent); if ($result) { return $result; } return self::GetUpperContentRights($content); }
/** * Finds the parent rights * @return BackendContentRights */ private function FindParentRights() { $parentRights = null; $parentContent = $this->Content()->Exists() ? ContentTreeUtil::ParentOf($this->Content()) : null; if ($parentContent) { $parentRights = RightsFinder::FindContentRights($parentContent); } if (!$parentRights) { switch ($this->Location()) { case Enums\ContentLocation::Page(): $pageRights = RightsFinder::FindPageRights($this->Page()); $parentRights = $pageRights ? $pageRights->GetContentRights() : null; break; case Enums\ContentLocation::Layout(): $layoutRights = $this->Area()->GetLayout()->GetUserGroupRights(); $parentRights = $layoutRights ? $layoutRights->GetContentRights() : null; break; case Enums\ContentLocation::Container(): $containerRights = $this->Container()->GetUserGroupRights(); $parentRights = $containerRights ? $containerRights->GetContentRights() : null; break; } } return $parentRights; }