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
6356dbd8
Commit
6356dbd8
authored
Mar 20, 2019
by
Bertrand Gauthier
Browse files
Modufucations pour passer à ZF3.
parent
c3f28ea5
Changes
5
Hide whitespace changes
Inline
Side-by-side
config/module.config.php
View file @
6356dbd8
...
...
@@ -14,9 +14,27 @@ use UnicaenAuth\Service\ShibServiceFactory;
use
UnicaenAuth\Service\UserContextFactory
;
use
UnicaenAuth\Service\UserFactory
;
use
UnicaenAuth\Service\UserMapperFactory
;
use
UnicaenAuth\View\Helper\LdapConnectViewHelper
;
use
UnicaenAuth\View\Helper\LdapConnectViewHelperFactory
;
use
UnicaenAuth\View\Helper\LocalConnectViewHelper
;
use
UnicaenAuth\View\Helper\LocalConnectViewHelperFactory
;
use
UnicaenAuth\View\Helper\ShibConnectViewHelper
;
use
UnicaenAuth\View\Helper\ShibConnectViewHelperFactory
;
use
UnicaenAuth\View\Helper\UserConnection
;
use
UnicaenAuth\View\Helper\UserConnectionFactory
;
use
UnicaenAuth\View\Helper\UserCurrent
;
use
UnicaenAuth\View\Helper\UserCurrentFactory
;
use
UnicaenAuth\View\Helper\UserInfo
;
use
UnicaenAuth\View\Helper\UserInfoFactory
;
use
UnicaenAuth\View\Helper\UserProfile
;
use
UnicaenAuth\View\Helper\UserProfileFactory
;
use
UnicaenAuth\View\Helper\UserProfileSelect
;
use
UnicaenAuth\View\Helper\UserProfileSelectFactory
;
use
UnicaenAuth\View\Helper\UserProfileSelectRadioItem
;
use
UnicaenAuth\View\Helper\UserProfileSelectRadioItemFactory
;
use
UnicaenAuth\View\Helper\UserStatus
;
use
UnicaenAuth\View\Helper\UserStatusFactory
;
use
UnicaenAuth\View\Helper\UserUsurpationHelper
;
use
UnicaenAuth\View\Helper\UserUsurpationHelperFactory
;
use
Zend\Authentication\AuthenticationService
;
use
Zend\ServiceManager\Proxy\LazyServiceFactory
;
...
...
@@ -422,10 +440,17 @@ return [
],
],
],
//
//( ! ) Warning: Declaration of
// Application\Service\UserContextServiceAwareTrait::setUserContextService(Application\Service\UserContextService $userContextService)
// should be compatible with
// UnicaenAuth\Controller\UtilisateurController::setUserContextService(UnicaenAuth\Service\UserContext $userContextService)
// in /var/www/sygal/module/Application/src/Application/Controller/UtilisateurController.php on line 34
'service_manager'
=>
[
'aliases'
=>
[
'Zend\Authentication\AuthenticationService'
=>
'zfcuser_auth_service'
,
'UnicaenAuth\Privilege\PrivilegeProvider'
=>
'UnicaenAuth\Service\Privilege'
,
'\UnicaenAuth\Guard\PrivilegeController'
=>
'UnicaenAuth\Guard\PrivilegeController'
,
'unicaen-auth_user_service'
=>
'UnicaenAuth\Service\User'
,
// pour la compatibilité
'authUserContext'
=>
'UnicaenAuth\Service\UserContext'
,
// pour la compatibilité
...
...
@@ -502,18 +527,31 @@ return [
],
'view_helpers'
=>
[
'factories'
=>
[
'userConnection'
=>
'UnicaenAuth\View\Helper\UserConnectionFactory'
,
'userCurrent'
=>
'UnicaenAuth\View\Helper\UserCurrentFactory'
,
'userStatus'
=>
'UnicaenAuth\View\Helper\UserStatusFactory'
,
'userProfile'
=>
'UnicaenAuth\View\Helper\UserProfileFactory'
,
'userInfo'
=>
'UnicaenAuth\View\Helper\UserInfoFactory'
,
'userProfileSelect'
=>
'UnicaenAuth\View\Helper\UserProfileSelectFactory'
,
'userProfileSelectRadioItem'
=>
'UnicaenAuth\View\Helper\UserProfileSelectRadioItemFactory'
,
'userUsurpation'
=>
UserUsurpationHelperFactory
::
class
,
'localConnect'
=>
LocalConnectViewHelperFactory
::
class
,
'ldapConnect'
=>
LdapConnectViewHelperFactory
::
class
,
'shibConnect'
=>
ShibConnectViewHelperFactory
::
class
,
'aliases'
=>
[
'userConnection'
=>
UserConnection
::
class
,
'userCurrent'
=>
UserCurrent
::
class
,
'userStatus'
=>
UserStatus
::
class
,
'userProfile'
=>
UserProfile
::
class
,
'userInfo'
=>
UserInfo
::
class
,
'userProfileSelect'
=>
UserProfileSelect
::
class
,
'userProfileSelectRadioItem'
=>
UserProfileSelectRadioItem
::
class
,
'userUsurpation'
=>
UserUsurpationHelper
::
class
,
'localConnect'
=>
LocalConnectViewHelper
::
class
,
'ldapConnect'
=>
LdapConnectViewHelper
::
class
,
'shibConnect'
=>
ShibConnectViewHelper
::
class
,
],
'factories'
=>
[
UserConnection
::
class
=>
UserConnectionFactory
::
class
,
UserCurrent
::
class
=>
UserCurrentFactory
::
class
,
UserStatus
::
class
=>
UserStatusFactory
::
class
,
UserProfile
::
class
=>
UserProfileFactory
::
class
,
UserInfo
::
class
=>
UserInfoFactory
::
class
,
UserProfileSelect
::
class
=>
UserProfileSelectFactory
::
class
,
UserProfileSelectRadioItem
::
class
=>
UserProfileSelectRadioItemFactory
::
class
,
UserUsurpationHelper
::
class
=>
UserUsurpationHelperFactory
::
class
,
LocalConnectViewHelper
::
class
=>
LocalConnectViewHelperFactory
::
class
,
LdapConnectViewHelper
::
class
=>
LdapConnectViewHelperFactory
::
class
,
ShibConnectViewHelper
::
class
=>
ShibConnectViewHelperFactory
::
class
,
],
'invokables'
=>
[
'appConnection'
=>
'UnicaenAuth\View\Helper\AppConnection'
,
...
...
src/UnicaenAuth/Controller/UtilisateurController.php
View file @
6356dbd8
...
...
@@ -9,6 +9,7 @@ use UnicaenAuth\Entity\Ldap\People;
use
UnicaenAuth\Entity\Shibboleth\ShibUser
;
use
UnicaenAuth\Options\ModuleOptions
;
use
UnicaenAuth\Service\ShibService
;
use
UnicaenAuth\Service\Traits\UserContextServiceAwareTrait
;
use
UnicaenAuth\Service\UserContext
;
use
Zend\Authentication\AuthenticationService
;
use
Zend\Http\Request
;
...
...
@@ -21,6 +22,8 @@ use ZfcUser\Mapper\User as UserMapper;
*/
class
UtilisateurController
extends
AbstractActionController
{
use
UserContextServiceAwareTrait
;
/**
* @var LdapPeopleMapper
*/
...
...
@@ -54,11 +57,6 @@ class UtilisateurController extends AbstractActionController
*/
private
$shibService
;
/**
* @var UserContext
*/
private
$userContextService
;
/**
* @param UserMapper $userMapper
*/
...
...
@@ -93,10 +91,11 @@ class UtilisateurController extends AbstractActionController
/**
* @param UserContext $userContextService
* @deprecated Utiliser UserContextServiceAwareTrait::setServiceUserContext() à la place, svp.
*/
public
function
setUserContextService
(
UserContext
$userContextService
)
{
$this
->
u
serContext
Service
=
$userContextService
;
$this
->
serviceU
serContext
=
$userContextService
;
}
/**
...
...
@@ -119,11 +118,11 @@ class UtilisateurController extends AbstractActionController
$role
=
$request
->
getPost
(
'role'
);
if
(
$role
)
{
$this
->
getAuth
UserContext
Service
()
->
setSelectedIdentityRole
(
$role
);
$this
->
service
UserContext
->
setSelectedIdentityRole
(
$role
);
}
if
(
$addFlashMessage
)
{
$selectedRole
=
$this
->
getAuth
UserContext
Service
()
->
getSelectedIdentityRoleToString
();
$selectedRole
=
$this
->
service
UserContext
->
getSelectedIdentityRoleToString
();
$message
=
sprintf
(
"Vous endossez à présent le profil utilisateur <strong>%s</strong>."
,
$selectedRole
);
$this
->
flashMessenger
()
->
setNamespace
(
'UnicaenAuth/success'
)
->
addMessage
(
$message
);
}
...
...
@@ -233,10 +232,11 @@ class UtilisateurController extends AbstractActionController
/**
* @return UserContext
* @deprecated Utiliser $this->serviceUserContext directement, svp.
*/
protected
function
getAuthUserContextService
()
{
return
$this
->
u
serContext
Service
;
return
$this
->
serviceU
serContext
;
}
/**
...
...
src/UnicaenAuth/Controller/UtilisateurControllerFactory.php
View file @
6356dbd8
...
...
@@ -38,7 +38,7 @@ class UtilisateurControllerFactory
$controller
=
new
UtilisateurController
();
$controller
->
setLdapPeopleMapper
(
$ldapPeopleMapper
);
$controller
->
setUserContext
Service
(
$userContextService
);
$controller
->
set
Service
UserContext
(
$userContextService
);
$controller
->
setOptions
(
$options
);
$controller
->
setShibService
(
$shibService
);
$controller
->
setAuthenticationService
(
$authenticationService
);
...
...
src/UnicaenAuth/Guard/PrivilegeController.php
View file @
6356dbd8
...
...
@@ -27,11 +27,13 @@ class PrivilegeController extends Controller
public
function
processConfig
()
{
$this
->
rules
=
$this
->
privilegesToRoles
(
$this
->
config
);
$this
->
rules
=
$this
->
privilegesToRoles
();
}
protected
function
privilegesToRoles
(
array
$rules
)
protected
function
privilegesToRoles
()
{
$rules
=
$this
->
config
;
$pr
=
$this
->
getPrivilegeProvider
()
->
getPrivilegesRoles
();
foreach
(
$rules
as
$index
=>
$rule
)
{
...
...
src/UnicaenAuth/View/Helper/UserProfile.php
View file @
6356dbd8
...
...
@@ -55,9 +55,9 @@ class UserProfile extends UserAbstract
$html
=
"<strong>
$title
:</strong>"
.
PHP_EOL
;
if
(
$this
->
userProfileSelectable
)
{
$html
.
=
$this
->
getV
iew
()
->
userProfileSelect
(
false
);
$html
.
=
$this
->
v
iew
->
userProfileSelect
(
false
);
}
else
{
$html
.
=
$this
->
getV
iew
()
->
htmlList
(
$roles
);
$html
.
=
$this
->
v
iew
->
htmlList
(
$roles
);
}
return
$html
;
...
...
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