Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
auth
Commits
318a5767
Commit
318a5767
authored
Mar 26, 2019
by
Bertrand Gauthier
Browse files
UserContextServiceAwareTrait: Suppression de la méthode inutile getServiceUserContext().
parent
55637ab2
Pipeline
#4139
passed with stage
in 22 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/UnicaenAuth/Assertion/AbstractAssertion.php
View file @
318a5767
...
...
@@ -145,7 +145,7 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
public
function
getRole
()
{
if
(
false
===
$this
->
role
){
$sUserContext
=
$this
->
getS
erviceUserContext
()
;
$sUserContext
=
$this
->
s
erviceUserContext
;
if
(
$sUserContext
->
getIdentity
())
{
$this
->
role
=
$sUserContext
->
getSelectedIdentityRole
();
}
...
...
src/UnicaenAuth/Controller/UtilisateurController.php
View file @
318a5767
...
...
@@ -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.
...
...
src/UnicaenAuth/Mouchard/MouchardCompleterAuth.php
View file @
318a5767
...
...
@@ -17,17 +17,18 @@ class MouchardCompleterAuth implements MouchardCompleterInterface
use
UserContextServiceAwareTrait
;
/**
* @param MouchardMessage $message
* @return $this
*/
public
function
complete
(
MouchardMessage
$message
)
{
$user
=
$this
->
getS
erviceUserContext
()
->
getDbUser
();
$user
=
$this
->
s
erviceUserContext
->
getDbUser
();
if
(
$user
){
$message
->
setUser
(
$user
->
getDisplayName
());
$message
->
setLogin
(
$user
->
getUsername
());
}
$message
->
setRole
((
string
)
$this
->
getS
erviceUserContext
()
->
getSelectedIdentityRole
());
$message
->
setRole
((
string
)
$this
->
s
erviceUserContext
->
getSelectedIdentityRole
());
return
$this
;
}
...
...
src/UnicaenAuth/Service/AuthorizeService.php
View file @
318a5767
...
...
@@ -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
->
getS
erviceUserContext
()
->
getSelectedIdentityRole
();
$role
=
$this
->
s
erviceUserContext
->
getSelectedIdentityRole
();
if
(
$role
)
return
$role
;
$roles
=
$this
->
getIdentityProvider
()
->
getIdentityRoles
();
...
...
src/UnicaenAuth/Service/Traits/UserContextServiceAwareTrait.php
View file @
318a5767
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment