mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-11 16:35:38 +00:00
check access on folder in 'searchfolder'
This commit is contained in:
parent
fc68b025ef
commit
100b0bfa26
|
@ -152,26 +152,30 @@ switch($command) {
|
|||
if(count($hits['folders']) == 1) {
|
||||
$hit = $hits['folders'][0];
|
||||
$basefolder = $dms->getFolder($hit->getID());
|
||||
if($subquery = substr($query, $pos+1)) {
|
||||
$hits = $dms->search($subquery, $limit=0, $offset=0, $logicalmode='AND', $searchin=array(), $startFolder=$basefolder, $owner=null, $status = array(), $creationstartdate=array(), $creationenddate=array(), $modificationstartdate=array(), $modificationenddate=array(), $categories=array(), $attributes=array(), $mode=0x2, $expirationstartdate=array(), $expirationenddate=array());
|
||||
if($hits) {
|
||||
if($basefolder->getAccessMode($user, 'search') >= M_READ) {
|
||||
if($subquery = substr($query, $pos+1)) {
|
||||
$hits = $dms->search($subquery, $limit=0, $offset=0, $logicalmode='AND', $searchin=array(), $startFolder=$basefolder, $owner=null, $status = array(), $creationstartdate=array(), $creationenddate=array(), $modificationstartdate=array(), $modificationenddate=array(), $categories=array(), $attributes=array(), $mode=0x2, $expirationstartdate=array(), $expirationenddate=array());
|
||||
if($hits) {
|
||||
$result = array();
|
||||
foreach($hits['folders'] as $hit) {
|
||||
if($hit->getAccessMode($user, 'search') >= M_READ)
|
||||
$result[] = $hit->getID().'#'.$basefolder->getName().'/'.$hit->getName();
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$subfolders = $basefolder->getSubFolders();
|
||||
$subfolders = SeedDMS_Core_DMS::filterAccess($subfolders, $user, M_READ);
|
||||
$result = array();
|
||||
foreach($hits['folders'] as $hit) {
|
||||
$result[] = $hit->getID().'#'.$basefolder->getName().'/'.$hit->getName();
|
||||
foreach($subfolders as $subfolder) {
|
||||
$result[] = $subfolder->getID().'#'.$basefolder->getName().'/'.$subfolder->getName();
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$subfolders = $basefolder->getSubFolders();
|
||||
$result = array();
|
||||
foreach($subfolders as $subfolder) {
|
||||
$result[] = $subfolder->getID().'#'.$basefolder->getName().'/'.$subfolder->getName();
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +184,8 @@ switch($command) {
|
|||
if($hits) {
|
||||
$result = array();
|
||||
foreach($hits['folders'] as $hit) {
|
||||
$result[] = $hit->getID().'#'.$hit->getName();
|
||||
if($hit->getAccessMode($user, 'search') >= M_READ)
|
||||
$result[] = $hit->getID().'#'.$hit->getName();
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($result);
|
||||
|
|
Loading…
Reference in New Issue
Block a user