Skip to content
Snippets Groups Projects

dev#189214: Add managed libraries select in users edit/add form

Viewing commit f2782b56
Show latest version
1 file
+ 10
4
Preferences
Compare changes
@@ -44,7 +44,7 @@ class Admin_ProfilController extends ZendAfi_Controller_Action {
$this->id_zone = $session['filtre_localisation']['id_zone'];
$this->id_bib = $session['filtre_localisation']['id_bib'];
if (isset($session['filtre_localisation']['managed_libraries']))
$this->managed_libraries = $session['filtre_localisation']['managed_libraries'];
$this->managed_libraries = $session['filtre_localisation']['managed_libraries'];
$this->_profil = Class_Profil::getCurrentProfil();
@@ -75,9 +75,7 @@ class Admin_ProfilController extends ZendAfi_Controller_Action {
continue;
if ($user->ROLE_LEVEL <= 5 and
! in_array($profil->getIdSite(),
$this->managed_libraries
?? [ $user->getLibraryId() ]))
! $this->_isProfilAllowedForUser($profil, $user))
continue;
if ($profil->isInPortail()) {
@@ -100,6 +98,14 @@ class Admin_ProfilController extends ZendAfi_Controller_Action {
}
protected function _isProfilAllowedForUser(Class_Profil $profil, Class_Users $user) :bool
{
return $this->managed_libraries
? in_array($profil->getIdSite(), $this->managed_libraries)
: $profil->getIdSite() == $user->ID_SITE;
}
public function proprietesAction() {
$this->view->titre = $this->_("Propriétés des modules: %s", $this->_profil->getLibelle());