mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 20:21:16 +00:00
add optional parameter to filterDocumentLinks()
This commit is contained in:
parent
0fd9c4d340
commit
57498f84a1
|
@ -259,13 +259,29 @@ class SeedDMS_Core_DMS {
|
|||
*
|
||||
* @param array $links list of objects of type SeedDMS_Core_DocumentLink
|
||||
* @param object $user user for which access is being checked
|
||||
* @param string $access set if source or target of link shall be checked
|
||||
* for sufficient access rights. Set to 'source' if the source document
|
||||
* of a link is to be checked, set to 'target' for the target document.
|
||||
* If not set, then access right aren't checked at all.
|
||||
* @return filtered list of links
|
||||
*/
|
||||
static function filterDocumentLinks($user, $links) { /* {{{ */
|
||||
static function filterDocumentLinks($user, $links, $access='') { /* {{{ */
|
||||
$tmp = array();
|
||||
foreach ($links as $link)
|
||||
if ($link->isPublic() || ($link->getUser()->getID() == $user->getID()) || $user->isAdmin())
|
||||
array_push($tmp, $link);
|
||||
foreach ($links as $link) {
|
||||
if ($link->isPublic() || ($link->getUser()->getID() == $user->getID()) || $user->isAdmin()){
|
||||
if($access == 'source') {
|
||||
$obj = $link->getDocument();
|
||||
if ($obj->getAccessMode($user) >= M_READ)
|
||||
array_push($tmp, $link);
|
||||
} elseif($access == 'target') {
|
||||
$obj = $link->getTarget();
|
||||
if ($obj->getAccessMode($user) >= M_READ)
|
||||
array_push($tmp, $link);
|
||||
} else {
|
||||
array_push($tmp, $link);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $tmp;
|
||||
} /* }}} */
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
|
||||
<notes>
|
||||
- order groups by name returned by getReadAccessList()
|
||||
- add optional parameter to SeedDMS_Core_DMS::filterDocumentLinks()
|
||||
</notes>
|
||||
<contents>
|
||||
<dir baseinstalldir="SeedDMS" name="/">
|
||||
|
|
Loading…
Reference in New Issue
Block a user