Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auth
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
lib
unicaen
auth
Commits
c3bcb1e9
Commit
c3bcb1e9
authored
Jan 7, 2016
by
Laurent Lecluse
Browse files
Options
Downloads
Patches
Plain Diff
Correction de bug
parent
ab04aec4
Branches
Branches containing commit
Tags
4.0.1
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/UnicaenAuth/Assertion/AbstractAssertion.php
+26
-1
26 additions, 1 deletion
src/UnicaenAuth/Assertion/AbstractAssertion.php
src/UnicaenAuth/Service/Traits/UserContextServiceAwareTrait.php
+5
-5
5 additions, 5 deletions
...icaenAuth/Service/Traits/UserContextServiceAwareTrait.php
with
31 additions
and
6 deletions
src/UnicaenAuth/Assertion/AbstractAssertion.php
+
26
−
1
View file @
c3bcb1e9
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
namespace
UnicaenAuth\Assertion
;
namespace
UnicaenAuth\Assertion
;
use
BjyAuthorize\Service\Authorize
;
use
UnicaenAuth\Service\Traits\UserContextServiceAwareTrait
;
use
Zend\Mvc\Application
;
use
Zend\Mvc\Application
;
use
Zend\Mvc\MvcEvent
;
use
Zend\Mvc\MvcEvent
;
use
Zend\Permissions\Acl\Acl
;
use
Zend\Permissions\Acl\Acl
;
...
@@ -19,6 +21,7 @@ use Zend\ServiceManager\ServiceLocatorAwareTrait;
...
@@ -19,6 +21,7 @@ use Zend\ServiceManager\ServiceLocatorAwareTrait;
abstract
class
AbstractAssertion
implements
AssertionInterface
,
ServiceLocatorAwareInterface
abstract
class
AbstractAssertion
implements
AssertionInterface
,
ServiceLocatorAwareInterface
{
{
use
ServiceLocatorAwareTrait
;
use
ServiceLocatorAwareTrait
;
use
UserContextServiceAwareTrait
;
/**
/**
* @var Acl
* @var Acl
...
@@ -28,7 +31,7 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
...
@@ -28,7 +31,7 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
/**
/**
* @var RoleInterface
* @var RoleInterface
*/
*/
private
$role
;
private
$role
=
false
;
...
@@ -94,6 +97,9 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
...
@@ -94,6 +97,9 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
*/
*/
public
function
getAcl
()
public
function
getAcl
()
{
{
if
(
!
$this
->
acl
){
$this
->
acl
=
$this
->
getServiceAuthorize
()
->
getAcl
();
}
return
$this
->
acl
;
return
$this
->
acl
;
}
}
...
@@ -118,6 +124,12 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
...
@@ -118,6 +124,12 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
*/
*/
public
function
getRole
()
public
function
getRole
()
{
{
if
(
false
===
$this
->
role
){
$sUserContext
=
$this
->
getServiceUserContext
();
if
(
$sUserContext
->
getIdentity
())
{
$this
->
role
=
$sUserContext
->
getSelectedIdentityRole
();
}
}
return
$this
->
role
;
return
$this
->
role
;
}
}
...
@@ -244,4 +256,17 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
...
@@ -244,4 +256,17 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
return
$application
->
getMvcEvent
();
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
This diff is collapsed.
Click to expand it.
src/UnicaenAuth/Service/Traits/UserContextServiceAwareTrait.php
+
5
−
5
View file @
c3bcb1e9
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
namespace
UnicaenAuth\Service\Traits
;
namespace
UnicaenAuth\Service\Traits
;
use
UnicaenAuth\Service\UserContext
Service
;
use
UnicaenAuth\Service\UserContext
;
use
RuntimeException
;
use
RuntimeException
;
/**
/**
...
@@ -13,18 +13,18 @@ use RuntimeException;
...
@@ -13,18 +13,18 @@ use RuntimeException;
trait
UserContextServiceAwareTrait
trait
UserContextServiceAwareTrait
{
{
/**
/**
* @var UserContext
Service
* @var UserContext
*/
*/
private
$serviceUserContext
;
private
$serviceUserContext
;
/**
/**
* @param UserContext
Service
$serviceUserContext
* @param UserContext $serviceUserContext
*
*
* @return self
* @return self
*/
*/
public
function
setServiceUserContext
(
UserContext
Service
$serviceUserContext
)
public
function
setServiceUserContext
(
UserContext
$serviceUserContext
)
{
{
$this
->
serviceUserContext
=
$serviceUserContext
;
$this
->
serviceUserContext
=
$serviceUserContext
;
...
@@ -34,7 +34,7 @@ trait UserContextServiceAwareTrait
...
@@ -34,7 +34,7 @@ trait UserContextServiceAwareTrait
/**
/**
* @return UserContext
Service
* @return UserContext
* @throws RuntimeException
* @throws RuntimeException
*/
*/
public
function
getServiceUserContext
()
public
function
getServiceUserContext
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment