mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
throw 403 error instead of 422 and display toast message
This commit is contained in:
@@ -18,9 +18,6 @@ use Symfony\Component\Validator\Constraint;
|
||||
*/
|
||||
class AccompanyingPeriodValidity extends Constraint
|
||||
{
|
||||
public $messageReferrerIsCurrentUser = 'Only the referrer can change the confidentiality of a parcours';
|
||||
|
||||
public $messageReferrerIsNull = 'A confidential parcours must have a referrer';
|
||||
|
||||
public $messageSocialIssueCannotBeDeleted = 'The social %name% issue cannot be deleted because it is associated with an activity or an action';
|
||||
|
||||
|
@@ -92,19 +92,5 @@ class AccompanyingPeriodValidityValidator extends ConstraintValidator
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
|
||||
/** Check if confidentiality can be toggled */
|
||||
$user = $period->getUser();
|
||||
$currentUser = $this->token->getToken()->getUser();
|
||||
|
||||
if ($user && ($user !== $currentUser) && $period->isConfidential() === true) {
|
||||
$this->context->buildViolation($constraint->messageReferrerIsCurrentUser)
|
||||
->addViolation();
|
||||
}
|
||||
|
||||
if (null === $user && $period->isConfidential() === true) {
|
||||
$this->context->buildViolation($constraint->messageReferrerIsNull)
|
||||
->addViolation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user