Commit 318a5767 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

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

parent 55637ab2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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();
            }
+0 −9
Original line number Diff line number Diff line
@@ -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.
+3 −2
Original line number Diff line number Diff line
@@ -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;
    }
+1 −1
Original line number Diff line number Diff line
@@ -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();
+2 −19
Original line number Diff line number Diff line
@@ -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