mirror of
https://gitlab.easter-eggs.com/ee/ldapsaisie.git
synced 2024-12-20 15:33:47 +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 :: startLSsession()) {
|
||||||
if (LSsession :: globalSearch()) {
|
if (LSsession :: globalSearch()) {
|
||||||
$LSobjects = LSsession :: $ldapServer['LSaccess'];
|
$LSaccess = LSsession :: getLSaccess();
|
||||||
$pattern = (isset($_REQUEST['pattern'])?$_REQUEST['pattern']:'');
|
$pattern = (isset($_REQUEST['pattern'])?$_REQUEST['pattern']:'');
|
||||||
|
|
||||||
$LSview_actions=array();
|
$LSview_actions=array();
|
||||||
|
@ -44,8 +44,8 @@ if(LSsession :: startLSsession()) {
|
||||||
|
|
||||||
if (LSsession :: loadLSclass('LSsearch')) {
|
if (LSsession :: loadLSclass('LSsearch')) {
|
||||||
$pages=array();
|
$pages=array();
|
||||||
foreach ($LSobjects as $LSobject) {
|
foreach ($LSaccess as $LSobject => $label) {
|
||||||
if ( LSsession :: loadLSobject($LSobject) ) {
|
if ( $LSobject != SELF && LSsession :: loadLSobject($LSobject) ) {
|
||||||
if (!LSconfig::get("LSobjects.$LSobject.globalSearch", true, 'bool'))
|
if (!LSconfig::get("LSobjects.$LSobject.globalSearch", true, 'bool'))
|
||||||
continue;
|
continue;
|
||||||
$object = new $LSobject();
|
$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('pattern',$pattern);
|
||||||
LStemplate :: assign('pages',$pages);
|
LStemplate :: assign('pages',$pages);
|
||||||
LSsession :: setTemplate('global_search.tpl');
|
LSsession :: setTemplate('global_search.tpl');
|
||||||
|
|
||||||
LStemplate :: addEvent('displayed', array($LSsearch, 'afterUsingResult'));
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LSerror :: addErrorCode('LSsession_11');
|
LSerror :: addErrorCode('LSsession_11');
|
||||||
|
|
|
@ -1404,10 +1404,9 @@ class LSsession {
|
||||||
$Css_txt.="<link rel='stylesheet' type='text/css' href='".$file."?nocache=$nocache' />\n";
|
$Css_txt.="<link rel='stylesheet' type='text/css' href='".$file."?nocache=$nocache' />\n";
|
||||||
}
|
}
|
||||||
LStemplate :: assign('LSsession_css',$Css_txt);
|
LStemplate :: assign('LSsession_css',$Css_txt);
|
||||||
|
|
||||||
if (isset(self :: $LSaccess[self :: $topDn])) {
|
// Access
|
||||||
LStemplate :: assign('LSaccess',self :: $LSaccess[self :: $topDn]);
|
LStemplate :: assign('LSaccess', self :: getLSaccess());
|
||||||
}
|
|
||||||
LStemplate :: assign('LSaddonsViewsAccess',self :: $LSaddonsViewsAccess);
|
LStemplate :: assign('LSaddonsViewsAccess',self :: $LSaddonsViewsAccess);
|
||||||
|
|
||||||
// Niveau
|
// Niveau
|
||||||
|
@ -1785,6 +1784,21 @@ class LSsession {
|
||||||
$_SESSION['LSsession']['LSaccess'] = $LSaccess;
|
$_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
|
* Load user access to LSaddons views
|
||||||
*
|
*
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if $globalSearch}
|
{if $globalSearch && $LSaccess}
|
||||||
<form action='global_search.php' method='post' class='LSview_search LSglobal_search'>
|
<form action='global_search.php' method='post' class='LSview_search LSglobal_search'>
|
||||||
<input type='hidden' name='LSsearch_submit' value='1'/>
|
<input type='hidden' name='LSsearch_submit' value='1'/>
|
||||||
<input type='text' name='pattern' class='LSview_search LSglobal_search' placeholder='{tr msg='Global search'}'/>
|
<input type='text' name='pattern' class='LSview_search LSglobal_search' placeholder='{tr msg='Global search'}'/>
|
||||||
|
|
Loading…
Reference in a new issue