Skip to content
Snippets Groups Projects
Commit 318a5767 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

UserContextServiceAwareTrait: Suppression de la méthode inutile getServiceUserContext().

parent 55637ab2
No related branches found
No related tags found
No related merge requests found
Pipeline #4139 passed
......@@ -145,7 +145,7 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
public function getRole()
{
if (false === $this->role){
$sUserContext = $this->getServiceUserContext();
$sUserContext = $this->serviceUserContext;
if ($sUserContext->getIdentity()) {
$this->role = $sUserContext->getSelectedIdentityRole();
}
......
......@@ -78,15 +78,6 @@ class UtilisateurController extends AbstractActionController
$this->options = $options;
}
/**
* @param UserContext $userContextService
* @deprecated Utiliser UserContextServiceAwareTrait::setServiceUserContext() à la place, svp.
*/
public function setUserContextService(UserContext $userContextService)
{
$this->serviceUserContext = $userContextService;
}
/**
* Traite les requêtes AJAX POST de sélection d'un profil utilisateur.
* La sélection est mémorisé en session par le service AuthUserContext.
......
......@@ -17,17 +17,18 @@ class MouchardCompleterAuth implements MouchardCompleterInterface
use UserContextServiceAwareTrait;
/**
* @param MouchardMessage $message
* @return $this
*/
public function complete(MouchardMessage $message)
{
$user = $this->getServiceUserContext()->getDbUser();
$user = $this->serviceUserContext->getDbUser();
if ($user){
$message->setUser($user->getDisplayName());
$message->setLogin($user->getUsername());
}
$message->setRole((string)$this->getServiceUserContext()->getSelectedIdentityRole());
$message->setRole((string)$this->serviceUserContext->getSelectedIdentityRole());
return $this;
}
......
......@@ -34,7 +34,7 @@ class AuthorizeService extends \BjyAuthorize\Service\Authorize
if ($this->loading) return 'bjyauthorize-identity';
// on retourne par défaut le rôle sélectionné
$role = $this->getServiceUserContext()->getSelectedIdentityRole();
$role = $this->serviceUserContext->getSelectedIdentityRole();
if ($role) return $role;
$roles = $this->getIdentityProvider()->getIdentityRoles();
......
......@@ -3,25 +3,19 @@
namespace UnicaenAuth\Service\Traits;
use UnicaenAuth\Service\UserContext;
use RuntimeException;
/**
* Description of UserContextServiceAwareTrait
*
* @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
* @author Unicaen
*/
trait UserContextServiceAwareTrait
{
/**
* @var UserContext
*/
private $serviceUserContext;
protected $serviceUserContext;
/**
* @param UserContext $serviceUserContext
*
* @return self
*/
public function setServiceUserContext(UserContext $serviceUserContext)
......@@ -30,15 +24,4 @@ trait UserContextServiceAwareTrait
return $this;
}
/**
* @return UserContext
* @throws RuntimeException
*/
public function getServiceUserContext()
{
return $this->serviceUserContext;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment