mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-30 03:23:48 +00:00
FEATURE [voter][confidential] voter adapted. repository changes left to do
This commit is contained in:
@@ -42,11 +42,6 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
|
||||
self::RE_OPEN_COURSE,
|
||||
];
|
||||
|
||||
/**
|
||||
* Give the ability to see all confidential courses.
|
||||
*/
|
||||
public const CONFIDENTIAL_CRUD = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CRUD_CONFIDENTIAL';
|
||||
|
||||
public const CREATE = 'CHILL_PERSON_ACCOMPANYING_PERIOD_CREATE';
|
||||
|
||||
/**
|
||||
@@ -110,7 +105,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
|
||||
/**
|
||||
* Right to see confidential period even if not referrer
|
||||
*/
|
||||
public const SEE_CONFIDENTIAL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_SEE_CONFIDENTIAL';
|
||||
public const SEE_CONFIDENTIAL_ALL = 'CHILL_PERSON_ACCOMPANYING_PERIOD_SEE_CONFIDENTIAL';
|
||||
|
||||
private Security $security;
|
||||
|
||||
@@ -136,7 +131,6 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
|
||||
return [
|
||||
self::SEE,
|
||||
self::SEE_DETAILS,
|
||||
self::CONFIDENTIAL_CRUD,
|
||||
self::CREATE,
|
||||
self::EDIT,
|
||||
self::DELETE,
|
||||
@@ -154,7 +148,7 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
|
||||
|
||||
public function getRolesWithoutScope(): array
|
||||
{
|
||||
return [self::REASSIGN_BULK];
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function supports($attribute, $subject)
|
||||
@@ -221,14 +215,10 @@ class AccompanyingPeriodVoter extends AbstractChillVoter implements ProvideRoleH
|
||||
|
||||
// if confidential, only the referent can see it
|
||||
if ($subject->isConfidential()) {
|
||||
if ($this->voterHelper->voteOnAttribute(self::CONFIDENTIAL_CRUD, $subject, $token)) {
|
||||
if ($this->voterHelper->voteOnAttribute(self::SEE_CONFIDENTIAL_ALL, $subject, $token)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* if ($this->voterHelper->voteOnAttribute(self::REASSIGN_BULK, null, $token)) {
|
||||
return true;
|
||||
}*/
|
||||
|
||||
return $token->getUser() === $subject->getUser();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user