added parameter to getReadAccessList()

the former settings value enableAdminRevApp will now be passed
to the function getReadAccessList(). A new parameter for adding
the owner was added too.
This commit is contained in:
Uwe Steinmann 2013-02-27 09:06:45 +01:00
parent e354233fce
commit 1b8aabdb06
2 changed files with 22 additions and 9 deletions

View File

@ -1659,10 +1659,18 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
* {@see SeedDMS_Core_Document::getReadAccessList()} instead. * {@see SeedDMS_Core_Document::getReadAccessList()} instead.
*/ */
function getApproversList() { /* {{{ */ function getApproversList() { /* {{{ */
return $this->getReadAccessList(); return $this->getReadAccessList(0, 0);
} /* }}} */ } /* }}} */
function getReadAccessList() { /* {{{ */ /**
* Returns a list of groups and users with read access on the document
*
* @param boolean $listadmin if set to true any admin will be listed too
* @param boolean $listowner if set to true the owner will be listed too
*
* @return array list of users and groups
*/
function getReadAccessList($listadmin=0, $listowner=0) { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
if (!isset($this->_readAccessList)) { if (!isset($this->_readAccessList)) {
@ -1686,7 +1694,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
} }
foreach ($tmpList["users"] as $userAccess) { foreach ($tmpList["users"] as $userAccess) {
$user = $userAccess->getUser(); $user = $userAccess->getUser();
if (!$this->_dms->enableAdminRevApp && $user->isAdmin()) continue; if (!$listadmin && $user->isAdmin()) continue;
if (!$listowner && $user->getID() == $this->_ownerID) continue;
if ($user->isGuest()) continue; if ($user->isGuest()) continue;
$userIDs .= (strlen($userIDs)==0 ? "" : ", ") . $userAccess->getUserID(); $userIDs .= (strlen($userIDs)==0 ? "" : ", ") . $userAccess->getUserID();
} }
@ -1739,7 +1748,8 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
if (!is_bool($resArr)) { if (!is_bool($resArr)) {
foreach ($resArr as $row) { foreach ($resArr as $row) {
$user = $this->_dms->getUser($row['id']); $user = $this->_dms->getUser($row['id']);
if (!$this->_dms->enableAdminRevApp && $user->isAdmin()) continue; if (!$listadmin && $user->isAdmin()) continue;
if (!$listowner && $user->getID() == $this->_ownerID) continue;
$this->_readAccessList["users"][] = $user; $this->_readAccessList["users"][] = $user;
} }
} }

View File

@ -1161,17 +1161,18 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
* {@see SeedDMS_Core_Folder::getReadAccessList()} instead. * {@see SeedDMS_Core_Folder::getReadAccessList()} instead.
*/ */
function getApproversList() { /* {{{ */ function getApproversList() { /* {{{ */
return $this->getReadAccessList(); return $this->getReadAccessList(0, 0);
} /* }}} */ } /* }}} */
/** /**
* Returns a list of groups and users with read access on the folder * Returns a list of groups and users with read access on the folder
* *
* * @param boolean $listadmin if set to true any admin will be listed too
* @param boolean $listowner if set to true the owner will be listed too
* *
* @return array list of users and groups * @return array list of users and groups
*/ */
function getReadAccessList() { /* {{{ */ function getReadAccessList($listadmin=0, $listowner=0) { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
if (!isset($this->_readAccessList)) { if (!isset($this->_readAccessList)) {
@ -1201,7 +1202,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
} }
foreach ($tmpList["users"] as $userAccess) { foreach ($tmpList["users"] as $userAccess) {
$user = $userAccess->getUser(); $user = $userAccess->getUser();
if (!$this->_dms->enableAdminRevApp && $user->isAdmin()) continue; if (!$listadmin && $user->isAdmin()) continue;
if (!$listowner && $user->getID() == $this->_ownerID) continue;
if ($user->isGuest()) continue; if ($user->isGuest()) continue;
$userIDs .= (strlen($userIDs)==0 ? "" : ", ") . $userAccess->getUserID(); $userIDs .= (strlen($userIDs)==0 ? "" : ", ") . $userAccess->getUserID();
} }
@ -1254,7 +1256,8 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
if (!is_bool($resArr)) { if (!is_bool($resArr)) {
foreach ($resArr as $row) { foreach ($resArr as $row) {
$user = $this->_dms->getUser($row['id']); $user = $this->_dms->getUser($row['id']);
if (!$this->_dms->enableAdminRevApp && $user->isAdmin()) continue; if (!$listadmin && $user->isAdmin()) continue;
if (!$listowner && $user->getID() == $this->_ownerID) continue;
$this->_readAccessList["users"][] = $user; $this->_readAccessList["users"][] = $user;
} }
} }