From 2bd75c6d1f71d1e6ab767a1dc057ec87a3881c6c Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 19 May 2020 17:49:32 +0200 Subject: [PATCH 1/2] add mode 'dryrun', actually check if a task is due --- utils/schedulercli.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/utils/schedulercli.php b/utils/schedulercli.php index ca7711842..132613468 100644 --- a/utils/schedulercli.php +++ b/utils/schedulercli.php @@ -19,7 +19,7 @@ function usage() { /* {{{ */ echo " -h, --help: print usage information and exit.\n"; echo " -v, --version: print version and exit.\n"; echo " --config: set alternative config file.\n"; - echo " --mode: set mode of operation (run, check, list).\n"; + echo " --mode: set mode of operation (run, dryrun, check, list).\n"; } /* }}} */ $version = "0.0.1"; @@ -49,7 +49,7 @@ if(isset($options['config'])) { $mode = 'list'; if(isset($options['mode'])) { - if(!in_array($options['mode'], array('run', 'check', 'list'))) { + if(!in_array($options['mode'], array('run', 'dryrun', 'check', 'list'))) { usage(); exit(1); } @@ -71,15 +71,20 @@ foreach($tasks as $task) { if(isset($GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()]) && is_object($taskobj = $GLOBALS['SEEDDMS_SCHEDULER']['tasks'][$task->getExtension()][$task->getTask()])) { switch($mode) { case "run": + case "dryrun": if(method_exists($taskobj, 'execute')) { - if(!$task->getDisabled()) { + if(!$task->getDisabled() && $task->isDue()) { if($user = $dms->getUserByLogin('cli_scheduler')) { - if($taskobj->execute($task, $dms, $user)) { - add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." successful."); - $task->updateLastNextRun(); - } else { - add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." failed, task has been disabled.", PEAR_LOG_ERR); - $task->setDisabled(1); + if($mode == 'run') { + if($taskobj->execute($task, $dms, $user)) { + add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." successful."); + $task->updateLastNextRun(); + } else { + add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." failed, task has been disabled.", PEAR_LOG_ERR); + $task->setDisabled(1); + } + } elseif($mode == 'dryrun') { + echo "Running ".$task->getExtension()."::".$task->getTask()."\n"; } } else { add_log_line("Execution of task ".$task->getExtension()."::".$task->getTask()." failed because of missing user 'cli_scheduler'. Task has been disabled.", PEAR_LOG_ERR); From aea42b9bf5d06754c58952296efa2ac5f6e6a1c6 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 19 May 2020 17:57:34 +0200 Subject: [PATCH 2/2] show access rights of folder/document if user has write access --- CHANGELOG | 1 + views/bootstrap/class.ViewDocument.php | 2 +- views/bootstrap/class.ViewFolder.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 988787574..b1f25b1e5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,7 @@ - use standard output for document rows on MyDocuments page - new seeddms logo - fix moving clipboard (Closes: #473) +- show access rights of folder/document if user has write access -------------------------------------------------------------------------------- Changes in version 5.1.16 diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index 09578ce74..fc86adb19 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -244,7 +244,7 @@ class SeedDMS_View_ViewDocument extends SeedDMS_Bootstrap_Style { isAdmin()) { + if($user->isAdmin() || $document->getAccessMode($user) > M_READ) { echo ""; echo "".getMLText('default_access').":"; echo "".$this->getAccessModeText($document->getDefaultAccess()).""; diff --git a/views/bootstrap/class.ViewFolder.php b/views/bootstrap/class.ViewFolder.php index 2e02df064..5c0df5135 100644 --- a/views/bootstrap/class.ViewFolder.php +++ b/views/bootstrap/class.ViewFolder.php @@ -262,7 +262,7 @@ $('body').on('click', '.order-btn', function(ev) { echo ""; } - if($user->isAdmin()) { + if($user->isAdmin() || $folder->getAccessMode($user) > M_READ) { echo ""; echo "".getMLText('default_access').":"; echo "".$this->getAccessModeText($folder->getDefaultAccess())."";