/** * Saves group and rights */ private function SaveRights() { $groupID = $this->Value('UserGroup'); $userGroup = Usergroup::Schema()->ByID($groupID); $this->container->SetUserGroup($userGroup); if (!$userGroup) { $oldRights = $this->container->GetUserGroupRights(); if ($oldRights) { $oldRights->GetContentRights()->Delete(); } $this->container->SetUserGroupRights(null); } else { $this->container->SetUserGroup($userGroup); $this->containerRights->Save(); $this->container->SetUserGroupRights($this->containerRights->Rights()); } $this->container->Save(); }
/** * Grant evaluation for adding content on top of a container * @param Container $container The container * @return GrantResult Returns the grant result telling if creation is allowed */ function GrantAddContentToContainer(Container $container) { //dummy content for evaluation $content = new Content(); $content->SetUserGroup($container->GetUserGroup()); $containerRights = $container->GetUserGroupRights(); if ($containerRights) { $content->SetUserGroupRights($containerRights->GetContentRights()); } return $this->Grant(BackendAction::Create(), $content); }