mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-16 06:31:21 +00:00
approver/reviewer can be set, even if admin
The old code got a list of all users with read rights on the document and then checked if the users to be added as a reviewer/approver is in this list. This did not work for the admin because the list only includes regular users.
This commit is contained in:
parent
baf4b9a979
commit
8cac883395
|
@ -1210,7 +1210,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if (isset($approvers[$i])) {
|
if (isset($approvers[$i])) {
|
||||||
foreach ($approvers[$i] as $approverID) {
|
foreach ($approvers[$i] as $approverID) {
|
||||||
$approver=($i=="i" ? $this->_dms->getUser($approverID) : $this->_dms->getGroup($approverID));
|
$approver=($i=="i" ? $this->_dms->getUser($approverID) : $this->_dms->getGroup($approverID));
|
||||||
$res=($i=="i" ? $docResultSet->getContent()->addIndApprover($approver, $user, !$pendingReview) : $docResultSet->getContent()->addGrpApprover($approver, $user, !$pendingReview));
|
$res=($i=="i" ? $docResultSet->getContent()->addIndApprover($approver, $user, true) : $docResultSet->getContent()->addGrpApprover($approver, $user, !$pendingReview));
|
||||||
$docResultSet->addApprover($approver, $i, $res);
|
$docResultSet->addApprover($approver, $i, $res);
|
||||||
if ($res==0 || $res=-3 || $res=-4) {
|
if ($res==0 || $res=-3 || $res=-4) {
|
||||||
$pendingApproval=true;
|
$pendingApproval=true;
|
||||||
|
@ -2380,14 +2380,18 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
return $this->_approvalStatus;
|
return $this->_approvalStatus;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function addIndReviewer($user, $requestUser) { /* {{{ */
|
function addIndReviewer($user, $requestUser, $listadmin=false) { /* {{{ */
|
||||||
$db = $this->_document->_dms->getDB();
|
$db = $this->_document->_dms->getDB();
|
||||||
|
|
||||||
$userID = $user->getID();
|
$userID = $user->getID();
|
||||||
|
|
||||||
// Get the list of users and groups with read access to this document.
|
// Get the list of users and groups with read access to this document.
|
||||||
|
if($this->_document->getAccessMode($user) < M_READ) {
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
/*
|
||||||
if (!isset($this->_readAccessList)) {
|
if (!isset($this->_readAccessList)) {
|
||||||
$this->_readAccessList = $this->_document->getReadAccessList();
|
$this->_readAccessList = $this->_document->getReadAccessList($listadmin);
|
||||||
}
|
}
|
||||||
$approved = false;
|
$approved = false;
|
||||||
foreach ($this->_readAccessList["users"] as $appUser) {
|
foreach ($this->_readAccessList["users"] as $appUser) {
|
||||||
|
@ -2399,6 +2403,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if (!$approved) {
|
if (!$approved) {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Check to see if the user has already been added to the review list.
|
// Check to see if the user has already been added to the review list.
|
||||||
$reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version);
|
$reviewStatus = $user->getReviewStatus($this->_document->getID(), $this->_version);
|
||||||
|
@ -2605,18 +2610,19 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function addIndApprover($user, $requestUser) { /* {{{ */
|
function addIndApprover($user, $requestUser, $listadmin=false) { /* {{{ */
|
||||||
$db = $this->_document->_dms->getDB();
|
$db = $this->_document->_dms->getDB();
|
||||||
|
|
||||||
$userID = $user->getID();
|
$userID = $user->getID();
|
||||||
|
|
||||||
// Get the list of users and groups with read access to this document.
|
// Get the list of users and groups with read access to this document.
|
||||||
if (!isset($this->_readAccessList)) {
|
if($this->_document->getAccessMode($user) < M_READ) {
|
||||||
// TODO: error checking.
|
return -2;
|
||||||
$this->_readAccessList = $this->_document->getReadAccessList();
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
$readAccessList = $this->_document->getReadAccessList($listadmin);
|
||||||
$approved = false;
|
$approved = false;
|
||||||
foreach ($this->_readAccessList["users"] as $appUser) {
|
foreach ($readAccessList["users"] as $appUser) {
|
||||||
if ($userID == $appUser->getID()) {
|
if ($userID == $appUser->getID()) {
|
||||||
$approved = true;
|
$approved = true;
|
||||||
break;
|
break;
|
||||||
|
@ -2625,6 +2631,7 @@ class SeedDMS_Core_DocumentContent extends SeedDMS_Core_Object { /* {{{ */
|
||||||
if (!$approved) {
|
if (!$approved) {
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// Check to see if the user has already been added to the approvers list.
|
// Check to see if the user has already been added to the approvers list.
|
||||||
$approvalStatus = $user->getApprovalStatus($this->_document->getID(), $this->_version);
|
$approvalStatus = $user->getApprovalStatus($this->_document->getID(), $this->_version);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user