Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
auth
Commits
c3bcb1e9
Commit
c3bcb1e9
authored
Jan 07, 2016
by
Laurent Lécluse
Browse files
Correction de bug
parent
ab04aec4
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/UnicaenAuth/Assertion/AbstractAssertion.php
View file @
c3bcb1e9
...
...
@@ -2,6 +2,8 @@
namespace
UnicaenAuth\Assertion
;
use
BjyAuthorize\Service\Authorize
;
use
UnicaenAuth\Service\Traits\UserContextServiceAwareTrait
;
use
Zend\Mvc\Application
;
use
Zend\Mvc\MvcEvent
;
use
Zend\Permissions\Acl\Acl
;
...
...
@@ -19,6 +21,7 @@ use Zend\ServiceManager\ServiceLocatorAwareTrait;
abstract
class
AbstractAssertion
implements
AssertionInterface
,
ServiceLocatorAwareInterface
{
use
ServiceLocatorAwareTrait
;
use
UserContextServiceAwareTrait
;
/**
* @var Acl
...
...
@@ -28,7 +31,7 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
/**
* @var RoleInterface
*/
private
$role
;
private
$role
=
false
;
...
...
@@ -94,6 +97,9 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
*/
public
function
getAcl
()
{
if
(
!
$this
->
acl
){
$this
->
acl
=
$this
->
getServiceAuthorize
()
->
getAcl
();
}
return
$this
->
acl
;
}
...
...
@@ -118,6 +124,12 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
*/
public
function
getRole
()
{
if
(
false
===
$this
->
role
){
$sUserContext
=
$this
->
getServiceUserContext
();
if
(
$sUserContext
->
getIdentity
())
{
$this
->
role
=
$sUserContext
->
getSelectedIdentityRole
();
}
}
return
$this
->
role
;
}
...
...
@@ -244,4 +256,17 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
return
$application
->
getMvcEvent
();
}
/**
* @return Authorize
*/
private
function
getServiceAuthorize
()
{
$serviceAuthorize
=
$this
->
getServiceLocator
()
->
get
(
'BjyAuthorize\Service\Authorize'
);
/* @var $serviceAuthorize Authorize */
return
$serviceAuthorize
;
}
}
\ No newline at end of file
src/UnicaenAuth/Service/Traits/UserContextServiceAwareTrait.php
View file @
c3bcb1e9
...
...
@@ -2,7 +2,7 @@
namespace
UnicaenAuth\Service\Traits
;
use
UnicaenAuth\Service\UserContext
Service
;
use
UnicaenAuth\Service\UserContext
;
use
RuntimeException
;
/**
...
...
@@ -13,18 +13,18 @@ use RuntimeException;
trait
UserContextServiceAwareTrait
{
/**
* @var UserContext
Service
* @var UserContext
*/
private
$serviceUserContext
;
/**
* @param UserContext
Service
$serviceUserContext
* @param UserContext $serviceUserContext
*
* @return self
*/
public
function
setServiceUserContext
(
UserContext
Service
$serviceUserContext
)
public
function
setServiceUserContext
(
UserContext
$serviceUserContext
)
{
$this
->
serviceUserContext
=
$serviceUserContext
;
...
...
@@ -34,7 +34,7 @@ trait UserContextServiceAwareTrait
/**
* @return UserContext
Service
* @return UserContext
* @throws RuntimeException
*/
public
function
getServiceUserContext
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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