fix right access and right on story elements per user

This commit is contained in:
aynsix
2020-03-12 16:16:41 +03:00
parent 900d56e09d
commit 597216429a
2 changed files with 19 additions and 4 deletions

View File

@@ -1735,7 +1735,9 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
throw new Exception('This record is not a grouping');
}
$selections = $this->getDatabox()->getRecordRepository()->findChildren([$this->getRecordId()], null, $offset, $max_items);
$user = $this->getAuthenticatedUser();
$selections = $this->getDatabox()->getRecordRepository()->findChildren([$this->getRecordId()], $user, $offset, $max_items);
return reset($selections);
}
@@ -1745,7 +1747,9 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
*/
public function get_grouping_parents()
{
$selections = $this->getDatabox()->getRecordRepository()->findParents([$this->getRecordId()]);
$user = $this->getAuthenticatedUser();
$selections = $this->getDatabox()->getRecordRepository()->findParents([$this->getRecordId()], $user);
return reset($selections);
}
@@ -1948,4 +1952,15 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
{
return $this->app['provider.repo.media_subdef']->getRepositoryForDatabox($this->getDataboxId());
}
/**
* @return User|null
*/
protected function getAuthenticatedUser()
{
/** @var \Alchemy\Phrasea\Authentication\Authenticator $authenticator */
$authenticator = $this->app['authentication'];
return $authenticator->getUser();
}
}