Commit 1e76a5c8 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

L'aide de vue UserPorfile ne renvoit rien dans le module unicaen-auth.

parent e5378b1d
......@@ -133,11 +133,11 @@ class Module implements ConfigProviderInterface, ViewHelperProviderInterface, Se
'userStatus' => function (HelperPluginManager $sm) {
return new View\Helper\UserStatus($sm->getServiceLocator()->get('zfcuser_auth_service'));
},
// 'userProfile' => function (HelperPluginManager $sm) {
// $helper = new View\Helper\UserProfile($sm->getServiceLocator()->get('zfcuser_auth_service'));
'userProfile' => function (HelperPluginManager $sm) {
$helper = new View\Helper\UserProfile($sm->getServiceLocator()->get('zfcuser_auth_service'));
// $helper->setIdentityProvider($sm->getServiceLocator()->get('BjyAuthorize\Service\Authorize')->getIdentityProvider());
// return $helper;
// },
return $helper;
},
'userInfo' => function (HelperPluginManager $sm) {
$helper = new View\Helper\UserInfo($sm->getServiceLocator()->get('zfcuser_auth_service'));
$helper->setServiceStructure($sm->getServiceLocator()->get('ldap_structure_service'));
......
<?php
namespace UnicaenAuth\View\Helper;
use BjyAuthorize\Provider\Identity\ProviderInterface as IdentityProvider;
/**
* Aide de vue permettant d'afficher le profil de l'utilisateur connecté.
*
......@@ -10,11 +8,6 @@ use BjyAuthorize\Provider\Identity\ProviderInterface as IdentityProvider;
*/
class UserProfile extends UserAbstract
{
/**
* @var IdentityProvider
*/
protected $identityProvider;
/**
* Point d'entrée.
*
......@@ -32,58 +25,6 @@ class UserProfile extends UserAbstract
*/
public function __toString()
{
if (!($identity = $this->getIdentity())) {
return null;
}
if ($identity instanceof \Zend\Permissions\Acl\Role\RoleInterface) {
$roles = array($identity->getRoleId());
}
else {
$roles = $this->getIdentityRoles();
}
$template = '<strong>' . $this->getView()->translate("Profil") . ' :</strong> %s';
$roles = $this->getView()->htmlList($roles, $ordered = false/*, $attribs = false, $escape = false*/);
$out = sprintf($template, $roles);
return $out;
}
/**
*
* @return array
*/
protected function getIdentityRoles()
{
$roles = array();
if ($this->getIdentityProvider()) {
$roles = $this->getIdentityProvider()->getIdentityRoles();
}
if (!$roles) {
$roles = array($this->getView()->translate("Aucun"));
}
return $roles;
}
/**
*
* @param IdentityProvider $provider
* @return \UnicaenAuth\View\Helper\UserProfile
*/
public function setIdentityProvider(IdentityProvider $provider)
{
$this->identityProvider = $provider;
return $this;
}
/**
*
* @return IdentityProvider
*/
public function getIdentityProvider()
{
return $this->identityProvider;
return '';
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment