|
|
@@ -28,7 +28,7 @@ class FileVoter extends AbstractVoter
|
|
|
* @param $subject File
|
|
|
* @return boolean
|
|
|
*/
|
|
|
- public function canView(object $subject): bool
|
|
|
+ protected function canView(object $subject): bool
|
|
|
{
|
|
|
// Le fichier n'est pas encore disponible
|
|
|
if(!$this->isAvailable($subject, $this->getUser())) {
|
|
|
@@ -86,7 +86,7 @@ class FileVoter extends AbstractVoter
|
|
|
* @param $subject File
|
|
|
* @return boolean
|
|
|
*/
|
|
|
- public function canEdit(object $subject): bool
|
|
|
+ protected function canEdit(object $subject): bool
|
|
|
{
|
|
|
// Le fichier n'est pas encore disponible
|
|
|
if(!$this->isAvailable($subject, $this->getUser())) {
|
|
|
@@ -118,7 +118,7 @@ class FileVoter extends AbstractVoter
|
|
|
* @param $subject File
|
|
|
* @return boolean
|
|
|
*/
|
|
|
- public function canCreate(object $subject): bool
|
|
|
+ protected function canCreate(object $subject): bool
|
|
|
{
|
|
|
// An authenticated user can create a file
|
|
|
if ($this->isUserLoggedIn()) {
|
|
|
@@ -133,7 +133,7 @@ class FileVoter extends AbstractVoter
|
|
|
* @param $subject File
|
|
|
* @return boolean
|
|
|
*/
|
|
|
- public function canDelete(object $subject): bool {
|
|
|
+ protected function canDelete(object $subject): bool {
|
|
|
return $this->canEdit($subject);
|
|
|
}
|
|
|
|
|
|
@@ -145,7 +145,7 @@ class FileVoter extends AbstractVoter
|
|
|
* @param Access $user
|
|
|
* @return bool
|
|
|
*/
|
|
|
- private function isInFileOwningGroup(File $file, Access $user): bool {
|
|
|
+ protected function isInFileOwningGroup(File $file, Access $user): bool {
|
|
|
$isOrganizationOwned = $file->getOrganization() && $file->getOrganization()->getId() === $user->getOrganization()->getId();
|
|
|
$isAccessOwned = $file->getPerson() && $file->getPerson()->getId() === $user->getPerson()->getId();
|
|
|
|
|
|
@@ -161,7 +161,7 @@ class FileVoter extends AbstractVoter
|
|
|
* @param Access $user
|
|
|
* @return bool
|
|
|
*/
|
|
|
- private function isInFileOwningGroupWithRole(File $file, Access $user): bool {
|
|
|
+ protected function isInFileOwningGroupWithRole(File $file, Access $user): bool {
|
|
|
|
|
|
$requiredRoles = $file->getAccessRoles();
|
|
|
if ($requiredRoles->count() === 0) {
|
|
|
@@ -184,7 +184,7 @@ class FileVoter extends AbstractVoter
|
|
|
* @return bool
|
|
|
* @throws \Exception
|
|
|
*/
|
|
|
- private function isAvailable(File $file, Access $user): bool {
|
|
|
+ protected function isAvailable(File $file, Access $user): bool {
|
|
|
|
|
|
$today = DatesUtils::new();
|
|
|
|