mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
remove mergeAccessList()
This commit is contained in:
parent
9346fa6072
commit
32d484a924
|
@ -334,61 +334,6 @@ class SeedDMS_Core_DMS {
|
|||
return $tmp;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Merge access lists
|
||||
*
|
||||
* Merges two access lists. Objects of the second list will override objects
|
||||
* in the first list.
|
||||
*
|
||||
* @param array $first list of access rights as returned by
|
||||
* SeedDMS_Core_Document:: getAccessList() or SeedDMS_Core_Folder::getAccessList()
|
||||
* @param array $secont list of access rights
|
||||
* @return array merged list
|
||||
*/
|
||||
static function mergeAccessLists($first, $second) { /* {{{ */
|
||||
if($first && !$second)
|
||||
return $first;
|
||||
if(!$first && $second)
|
||||
return $second;
|
||||
|
||||
$tmp = array('users'=>array(), 'groups'=>array());
|
||||
if(!isset($first['users']) || !isset($first['groups']) ||
|
||||
!isset($second['users']) || !isset($second['groups']))
|
||||
return false;
|
||||
|
||||
foreach ($first['users'] as $f) {
|
||||
$new = $f;
|
||||
foreach ($second['users'] as $i=>$s) {
|
||||
if($f->getUserID() == $s->getUserID()) {
|
||||
$new = $s;
|
||||
unset($second['users'][$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
array_push($tmp['users'], $new);
|
||||
}
|
||||
foreach ($seconf['users'] as $f) {
|
||||
array_push($tmp['users'], $f);
|
||||
}
|
||||
|
||||
foreach ($first['groups'] as $f) {
|
||||
$new = $f;
|
||||
foreach ($second['groups'] as $i=>$s) {
|
||||
if($f->getGroupID() == $s->getGroupID()) {
|
||||
$new = $s;
|
||||
unset($second['groups'][$i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
array_push($tmp['groups'], $new);
|
||||
}
|
||||
foreach ($second['groups'] as $f) {
|
||||
array_push($tmp['groups'], $f);
|
||||
}
|
||||
|
||||
return $tmp;
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Create a new instance of the dms
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue
Block a user