mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-11-19 08:39:06 +01:00
Fix global_search in multiple subDn context
This commit is contained in:
parent
80de0db523
commit
1b28066189
3 changed files with 23 additions and 10 deletions
|
@ -24,7 +24,7 @@ require_once 'core.php';
|
|||
|
||||
if(LSsession :: startLSsession()) {
|
||||
if (LSsession :: globalSearch()) {
|
||||
$LSobjects = LSsession :: $ldapServer['LSaccess'];
|
||||
$LSaccess = LSsession :: getLSaccess();
|
||||
$pattern = (isset($_REQUEST['pattern'])?$_REQUEST['pattern']:'');
|
||||
|
||||
$LSview_actions=array();
|
||||
|
@ -44,8 +44,8 @@ if(LSsession :: startLSsession()) {
|
|||
|
||||
if (LSsession :: loadLSclass('LSsearch')) {
|
||||
$pages=array();
|
||||
foreach ($LSobjects as $LSobject) {
|
||||
if ( LSsession :: loadLSobject($LSobject) ) {
|
||||
foreach ($LSaccess as $LSobject => $label) {
|
||||
if ( $LSobject != SELF && LSsession :: loadLSobject($LSobject) ) {
|
||||
if (!LSconfig::get("LSobjects.$LSobject.globalSearch", true, 'bool'))
|
||||
continue;
|
||||
$object = new $LSobject();
|
||||
|
@ -80,6 +80,7 @@ if(LSsession :: startLSsession()) {
|
|||
}
|
||||
}
|
||||
}
|
||||
$LSsearch -> afterUsingResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,8 +95,6 @@ if(LSsession :: startLSsession()) {
|
|||
LStemplate :: assign('pattern',$pattern);
|
||||
LStemplate :: assign('pages',$pages);
|
||||
LSsession :: setTemplate('global_search.tpl');
|
||||
|
||||
LStemplate :: addEvent('displayed', array($LSsearch, 'afterUsingResult'));
|
||||
}
|
||||
else {
|
||||
LSerror :: addErrorCode('LSsession_11');
|
||||
|
|
|
@ -1404,10 +1404,9 @@ class LSsession {
|
|||
$Css_txt.="<link rel='stylesheet' type='text/css' href='".$file."?nocache=$nocache' />\n";
|
||||
}
|
||||
LStemplate :: assign('LSsession_css',$Css_txt);
|
||||
|
||||
if (isset(self :: $LSaccess[self :: $topDn])) {
|
||||
LStemplate :: assign('LSaccess',self :: $LSaccess[self :: $topDn]);
|
||||
}
|
||||
|
||||
// Access
|
||||
LStemplate :: assign('LSaccess', self :: getLSaccess());
|
||||
LStemplate :: assign('LSaddonsViewsAccess',self :: $LSaddonsViewsAccess);
|
||||
|
||||
// Niveau
|
||||
|
@ -1785,6 +1784,21 @@ class LSsession {
|
|||
$_SESSION['LSsession']['LSaccess'] = $LSaccess;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user access
|
||||
*
|
||||
* @param[in] $topDn string Top DN (optional, default : current)
|
||||
*
|
||||
* @retval array User's access
|
||||
**/
|
||||
public static function getLSaccess($topDn=null) {
|
||||
if (is_null($topDn)) $topDn = self :: $topDn;
|
||||
if (isset(self :: $LSaccess[self :: $topDn])) {
|
||||
return self :: $LSaccess[self :: $topDn];
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Load user access to LSaddons views
|
||||
*
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
</form>
|
||||
{/if}
|
||||
|
||||
{if $globalSearch}
|
||||
{if $globalSearch && $LSaccess}
|
||||
<form action='global_search.php' method='post' class='LSview_search LSglobal_search'>
|
||||
<input type='hidden' name='LSsearch_submit' value='1'/>
|
||||
<input type='text' name='pattern' class='LSview_search LSglobal_search' placeholder='{tr msg='Global search'}'/>
|
||||
|
|
Loading…
Reference in a new issue