Loading CHANGELOG.md +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,9 @@ author: Laurent Lécluse - DSI - Unicaen ## Corrections de bugs * Les informations complémentaires de l'utilisateur (qui relevaient d'une liste spécifique à l'Université de Caen et qui pouvait amener un plantage de l'application) ne sont plus affichées lorsqu'on clique sur l'utilisateur en haut à gauche. # OSE 8.1.2 ## Corrections de bugs Loading module/Application/config/aaa_module.config.php +1 −0 Original line number Diff line number Diff line Loading @@ -171,6 +171,7 @@ $config = [ 'factories' => [ 'userProfileSelectRadioItem' => View\Helper\UserProfileSelectRadioItemFactory::class, 'appLink' => View\Helper\AppLinkFactory::class, 'userCurrent' => View\Helper\UserCurrentFactory::class, ], 'invokables' => [ 'utilisateur' => View\Helper\UtilisateurViewHelper::class, Loading module/Application/src/Application/View/Helper/UserCurrent.php 0 → 100644 +90 −0 Original line number Diff line number Diff line <?php namespace Application\View\Helper; use UnicaenAuth\View\Helper\UserAbstract; /** * Aide de vue affichant toutes les infos concernant l'utilisateur courant. * C'est à dire : * - "Aucun" + lien de connexion OU BIEN nom de l'utilisateur connecté + lien de déconnexion * - profil de l'utilisateur connecté * - infos administratives sur l'utilisateur * * @author Bertrand GAUTHIER <bertrand.gauthier@unicaen.fr> */ class UserCurrent extends UserAbstract { /** * Point d'entrée. * * @param boolean $affectationFineSiDispo Indique s'il faut prendre en compte l'affectation * plus fine (ucbnSousStructure) si elle existe, à la place de l'affectation standard (niveau 2) * * @return self */ public function __invoke($affectationFineSiDispo = false) { return $this; } /** * Retourne le code HTML généré par cette aide de vue. * * @return string */ public function __toString() { $id = 'user-current-info'; $userStatusHelper = $this->getView()->plugin('userStatus'); /* @var $userStatusHelper \UnicaenAuth\View\Helper\UserStatus */ $status = $userStatusHelper(false); $userProfileSelectable = true; if ($this->getIdentity()) { if ($userProfileSelectable) { // DS : cas où aucun rôle n'est sélectionné, on affiche le rôle "user" $role = $this->getUserContext()->getSelectedIdentityRole() ?: $this->getUserContext()->getIdentityRole('user'); $status .= sprintf(", <small>%s</small>", !method_exists($role, '__toString') ? $role->getRoleId() : $role); } $userProfileHelper = $this->getView()->plugin('userProfile'); /* @var $userProfileHelper \UnicaenAuth\View\Helper\UserProfile */ $userProfileHelper->setUserProfileSelectable($userProfileSelectable); $content = $userProfileHelper; } else { $content = _("Aucun"); } $content = htmlspecialchars(preg_replace('/\r\n|\n|\r/', '', $content)); $title = _("Utilisateur connecté à l'application"); $out = <<<EOS <a class="navbar-link" id="$id" title="$title" data-placement="bottom" data-toggle="popover" data-html="true" data-content="$content" href="#">$status</a> EOS; $out .= PHP_EOL; $js = <<<EOS $(function() { $("#$id").popover({ html: true, container: '#navbar' }); }); EOS; $this->getView()->plugin('inlineScript')->offsetSetScript(1000, $js); return $out; } } module/Application/src/Application/View/Helper/UserCurrentFactory.php 0 → 100644 +27 −0 Original line number Diff line number Diff line <?php namespace Application\View\Helper; use Zend\ServiceManager\FactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; /** * Description of UserCurrentFactory * * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> */ class UserCurrentFactory implements FactoryInterface { /** * Create service * * @param ServiceLocatorInterface $helperPluginManager * @return UserCurrent */ public function createService(ServiceLocatorInterface $helperPluginManager) { $authUserContext = $helperPluginManager->getServiceLocator()->get('authUserContext'); return new UserCurrent($authUserContext); } } No newline at end of file Loading
CHANGELOG.md +3 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,9 @@ author: Laurent Lécluse - DSI - Unicaen ## Corrections de bugs * Les informations complémentaires de l'utilisateur (qui relevaient d'une liste spécifique à l'Université de Caen et qui pouvait amener un plantage de l'application) ne sont plus affichées lorsqu'on clique sur l'utilisateur en haut à gauche. # OSE 8.1.2 ## Corrections de bugs Loading
module/Application/config/aaa_module.config.php +1 −0 Original line number Diff line number Diff line Loading @@ -171,6 +171,7 @@ $config = [ 'factories' => [ 'userProfileSelectRadioItem' => View\Helper\UserProfileSelectRadioItemFactory::class, 'appLink' => View\Helper\AppLinkFactory::class, 'userCurrent' => View\Helper\UserCurrentFactory::class, ], 'invokables' => [ 'utilisateur' => View\Helper\UtilisateurViewHelper::class, Loading
module/Application/src/Application/View/Helper/UserCurrent.php 0 → 100644 +90 −0 Original line number Diff line number Diff line <?php namespace Application\View\Helper; use UnicaenAuth\View\Helper\UserAbstract; /** * Aide de vue affichant toutes les infos concernant l'utilisateur courant. * C'est à dire : * - "Aucun" + lien de connexion OU BIEN nom de l'utilisateur connecté + lien de déconnexion * - profil de l'utilisateur connecté * - infos administratives sur l'utilisateur * * @author Bertrand GAUTHIER <bertrand.gauthier@unicaen.fr> */ class UserCurrent extends UserAbstract { /** * Point d'entrée. * * @param boolean $affectationFineSiDispo Indique s'il faut prendre en compte l'affectation * plus fine (ucbnSousStructure) si elle existe, à la place de l'affectation standard (niveau 2) * * @return self */ public function __invoke($affectationFineSiDispo = false) { return $this; } /** * Retourne le code HTML généré par cette aide de vue. * * @return string */ public function __toString() { $id = 'user-current-info'; $userStatusHelper = $this->getView()->plugin('userStatus'); /* @var $userStatusHelper \UnicaenAuth\View\Helper\UserStatus */ $status = $userStatusHelper(false); $userProfileSelectable = true; if ($this->getIdentity()) { if ($userProfileSelectable) { // DS : cas où aucun rôle n'est sélectionné, on affiche le rôle "user" $role = $this->getUserContext()->getSelectedIdentityRole() ?: $this->getUserContext()->getIdentityRole('user'); $status .= sprintf(", <small>%s</small>", !method_exists($role, '__toString') ? $role->getRoleId() : $role); } $userProfileHelper = $this->getView()->plugin('userProfile'); /* @var $userProfileHelper \UnicaenAuth\View\Helper\UserProfile */ $userProfileHelper->setUserProfileSelectable($userProfileSelectable); $content = $userProfileHelper; } else { $content = _("Aucun"); } $content = htmlspecialchars(preg_replace('/\r\n|\n|\r/', '', $content)); $title = _("Utilisateur connecté à l'application"); $out = <<<EOS <a class="navbar-link" id="$id" title="$title" data-placement="bottom" data-toggle="popover" data-html="true" data-content="$content" href="#">$status</a> EOS; $out .= PHP_EOL; $js = <<<EOS $(function() { $("#$id").popover({ html: true, container: '#navbar' }); }); EOS; $this->getView()->plugin('inlineScript')->offsetSetScript(1000, $js); return $out; } }
module/Application/src/Application/View/Helper/UserCurrentFactory.php 0 → 100644 +27 −0 Original line number Diff line number Diff line <?php namespace Application\View\Helper; use Zend\ServiceManager\FactoryInterface; use Zend\ServiceManager\ServiceLocatorInterface; /** * Description of UserCurrentFactory * * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> */ class UserCurrentFactory implements FactoryInterface { /** * Create service * * @param ServiceLocatorInterface $helperPluginManager * @return UserCurrent */ public function createService(ServiceLocatorInterface $helperPluginManager) { $authUserContext = $helperPluginManager->getServiceLocator()->get('authUserContext'); return new UserCurrent($authUserContext); } } No newline at end of file