cleanup functions need admin right
authorPhilipp Schüle <p.schuele@metaways.de>
Fri, 26 May 2017 07:41:33 +0000 (09:41 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Fri, 26 May 2017 12:28:58 +0000 (14:28 +0200)
activated check for
* cleanRelations
* cleanNotes
* cleanCustomfields

Change-Id: I5b64388e1a0d68c299fbce8ec03d3be0d04483fd
Reviewed-on: http://gerrit.tine20.com/customers/4763
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Frontend/Cli.php

index 0a11537..a5adb9a 100644 (file)
@@ -150,6 +150,10 @@ class Tinebase_Frontend_Cli extends Tinebase_Frontend_Cli_Abstract
      */
     public function cleanModlog()
     {
+        if (! $this->_checkAdminRight()) {
+            return FALSE;
+        }
+
         $deleted = Tinebase_Timemachine_ModificationLog::getInstance()->clean();
 
         echo "\ndeleted $deleted modlogs records\n";
@@ -160,6 +164,10 @@ class Tinebase_Frontend_Cli extends Tinebase_Frontend_Cli_Abstract
      */
     public function cleanRelations()
     {
+        if (! $this->_checkAdminRight()) {
+            return FALSE;
+        }
+
         $relations = Tinebase_Relations::getInstance();
         $filter = new Tinebase_Model_Filter_FilterGroup();
         $pagination = new Tinebase_Model_Pagination();
@@ -512,10 +520,14 @@ class Tinebase_Frontend_Cli extends Tinebase_Frontend_Cli_Abstract
     }
 
     /**
-     * cleanNotes
+     * cleanNotes: removes notes of records that have been deleted
      */
     public function cleanNotes()
     {
+        if (! $this->_checkAdminRight()) {
+            return FALSE;
+        }
+
         $notesController = Tinebase_Notes::getInstance();
         $notes = $notesController->getAllNotes();
         $controllers = array();
@@ -601,6 +613,10 @@ class Tinebase_Frontend_Cli extends Tinebase_Frontend_Cli_Abstract
      */
     public function cleanCustomfields()
     {
+        if (! $this->_checkAdminRight()) {
+            return FALSE;
+        }
+
         $customFieldController = Tinebase_CustomField::getInstance();
         $customFieldConfigs = $customFieldController->searchConfig();
         $deleteCount = 0;