Commit 0a7b3ecd by Damien Moulard

Merge branch '4286-annulation-modifications-4176' into 'develop'

4286 annulation modifications 4176

See merge request cooperatic/kohinos-tav!24
parents 368bf173 8e1b51c6
......@@ -131,8 +131,7 @@ App\Entity\Usergroup:
'ROLE_ADMIN_PRESTATAIRE_GERER_EDIT',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_EDIT',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_LIST',
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_CREATE',
'ROLE_CHANGE_ADHERENT_PERSONAL_DATA']]
'ROLE_ADMIN_PRESTATAIRE_COTISATIONS_CREATE']]
usergroup_contact:
__construct: ['Contact', [
'ROLE_CONTACT',
......
......@@ -194,10 +194,7 @@ class UserAdmin extends BaseUserAdmin
->add('username')
->add('email')
;
if (
'dev' == $_ENV['APP_ENV'] && ($this->isGranted('ROLE_SUPER_ADMIN')
|| $this->getSecurityHandler()->grantChangeAdherentPasswordToNonSuperAdmin('ROLE_CHANGE_ADHERENT_PERSONAL_DATA'))
) {
if ('dev' == $_ENV['APP_ENV'] && $this->isGranted('ROLE_SUPER_ADMIN')) {
$formMapper
->add('plainPassword', RepeatedType::class, [
'type' => PasswordType::class,
......
......@@ -3,7 +3,6 @@
namespace App\Security\Handler;
use App\Entity\GlobalParameter;
use App\Entity\User;
use Doctrine\ORM\EntityManagerInterface;
use Sonata\AdminBundle\Admin\AdminInterface;
use Sonata\AdminBundle\Security\Handler\RoleSecurityHandler;
......@@ -44,8 +43,7 @@ class VoterSecurityHandler extends RoleSecurityHandler
try {
return $this->isAnyGranted($this->superAdminRoles)
|| $this->isAnyGranted($attributes, $object)
|| $this->isAnyGranted([$allRole], $object)
|| $this->allowToModifyAdherentPersonalData($object);
|| $this->isAnyGranted([$allRole], $object);
} catch (AuthenticationCredentialsNotFoundException $e) {
return false;
}
......@@ -66,16 +64,4 @@ class VoterSecurityHandler extends RoleSecurityHandler
return false;
}
private function allowToModifyAdherentPersonalData($object): bool
{
return $_ENV['TAV_ENV']
&& $object instanceof User && $object->getAdherent()
&& $this->authorizationChecker->isGranted('ROLE_CHANGE_ADHERENT_PERSONAL_DATA');
}
public function grantChangeAdherentPasswordToNonSuperAdmin($str): bool
{
return $_ENV['TAV_ENV'] && $this->authorizationChecker->isGranted($str);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment