mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-12 20:51:30 +00:00
add new methods getMandatoryReviewers() and getMandatoryApprovers()
This commit is contained in:
parent
08ee240dc1
commit
20586c021d
|
@ -33,13 +33,13 @@ function formatted_size($size_bytes) { /* {{{ */
|
||||||
* dd for %d
|
* dd for %d
|
||||||
* This functions returns the converted format
|
* This functions returns the converted format
|
||||||
*/
|
*/
|
||||||
function getConvertDateFormat() {
|
function getConvertDateFormat() { /* {{{ */
|
||||||
global $settings;
|
global $settings;
|
||||||
if($settings->_dateformat) {
|
if($settings->_dateformat) {
|
||||||
return str_replace(['y', 'Y', 'm', 'M', 'F', 'd', 'l', 'D'], ['yy', 'yyyy', 'mm', 'M', 'MM', 'dd', 'DD', 'D'], $settings->_dateformat);
|
return str_replace(['y', 'Y', 'm', 'M', 'F', 'd', 'l', 'D'], ['yy', 'yyyy', 'mm', 'M', 'MM', 'dd', 'DD', 'D'], $settings->_dateformat);
|
||||||
} else
|
} else
|
||||||
return 'yyyy-mm-dd';
|
return 'yyyy-mm-dd';
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
function getReadableDate($timestamp=0) { /* {{{ */
|
function getReadableDate($timestamp=0) { /* {{{ */
|
||||||
global $settings;
|
global $settings;
|
||||||
|
@ -431,7 +431,7 @@ function _add_log_line($msg="") { /* {{{ */
|
||||||
}
|
}
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function getFolderPathHTML($folder, $tagAll=false, $document=null) { /* {{{ */
|
function getFolderPathHTML($folder, $tagAll=false, $document=null) { /* {{{ */
|
||||||
$path = $folder->getPath();
|
$path = $folder->getPath();
|
||||||
$txtpath = "";
|
$txtpath = "";
|
||||||
for ($i = 0; $i < count($path); $i++) {
|
for ($i = 0; $i < count($path); $i++) {
|
||||||
|
@ -448,7 +448,7 @@ function _add_log_line($msg="") { /* {{{ */
|
||||||
$txtpath .= " / <a href=\"../out/out.ViewDocument.php?documentid=".$document->getId()."\">".htmlspecialchars($document->getName())."</a>";
|
$txtpath .= " / <a href=\"../out/out.ViewDocument.php?documentid=".$document->getId()."\">".htmlspecialchars($document->getName())."</a>";
|
||||||
|
|
||||||
return $txtpath;
|
return $txtpath;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
function showtree() { /* {{{ */
|
function showtree() { /* {{{ */
|
||||||
global $settings;
|
global $settings;
|
||||||
|
@ -776,6 +776,82 @@ function createNonce() { /* {{{ */
|
||||||
return base64_encode($bytes);
|
return base64_encode($bytes);
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the mandatory reviewers
|
||||||
|
*
|
||||||
|
* This function checks if the reviewers have at least read access
|
||||||
|
* on the folder containing the document.
|
||||||
|
*
|
||||||
|
* @param $folder folder where document is located
|
||||||
|
* @param $user user creating the new version or document
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function getMandatoryReviewers($folder, $user) { /* {{{ */
|
||||||
|
global $settings;
|
||||||
|
|
||||||
|
/* Get a list of all users and groups with read access on the folder.
|
||||||
|
* Only those users and groups will be added as reviewers
|
||||||
|
*/
|
||||||
|
$docAccess = $folder->getReadAccessList($settings->_enableAdminRevApp, $settings->_enableOwnerRevApp);
|
||||||
|
$res=$user->getMandatoryReviewers();
|
||||||
|
$reviewers = array('i'=>[], 'g'=>[]);
|
||||||
|
foreach ($res as $r){
|
||||||
|
if ($r['reviewerUserID']!=0){
|
||||||
|
foreach ($docAccess["users"] as $usr)
|
||||||
|
if ($usr->getID()==$r['reviewerUserID']){
|
||||||
|
$reviewers["i"][] = $r['reviewerUserID'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} elseif ($r['reviewerGroupID']!=0){
|
||||||
|
foreach ($docAccess["groups"] as $grp)
|
||||||
|
if ($grp->getID()==$r['reviewerGroupID']){
|
||||||
|
$reviewers["g"][] = $r['reviewerGroupID'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $reviewers;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the mandatory approvers
|
||||||
|
*
|
||||||
|
* This function checks if the approvers have at least read access
|
||||||
|
* on the folder containing the document.
|
||||||
|
*
|
||||||
|
* @param $folder folder where document is located
|
||||||
|
* @param $user user creating the new version or document
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function getMandatoryApprovers($folder, $user) { /* {{{ */
|
||||||
|
global $settings;
|
||||||
|
|
||||||
|
/* Get a list of all users and groups with read access on the folder.
|
||||||
|
* Only those users and groups will be added as approvers
|
||||||
|
*/
|
||||||
|
$docAccess = $folder->getReadAccessList($settings->_enableAdminRevApp, $settings->_enableOwnerRevApp);
|
||||||
|
$res=$user->getMandatoryApprovers();
|
||||||
|
$approvers = array('i'=>[], 'g'=>[]);
|
||||||
|
foreach ($res as $r){
|
||||||
|
|
||||||
|
if ($r['approverUserID']!=0){
|
||||||
|
foreach ($docAccess["users"] as $usr)
|
||||||
|
if ($usr->getID()==$r['approverUserID']){
|
||||||
|
$approvers["i"][] = $r['approverUserID'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if ($r['approverGroupID']!=0){
|
||||||
|
foreach ($docAccess["groups"] as $grp)
|
||||||
|
if ($grp->getID()==$r['approverGroupID']){
|
||||||
|
$approvers["g"][] = $r['approverGroupID'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $approvers;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for creating encrypted api keys
|
* Class for creating encrypted api keys
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user