0011370: repair function for persistent filters without grants
authorPhilipp Schüle <p.schuele@metaways.de>
Thu, 22 Oct 2015 15:09:56 +0000 (17:09 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Thu, 22 Oct 2015 15:53:18 +0000 (17:53 +0200)
* introduce ignoreAcl to find filters without grants

https://forge.tine20.org/view.php?id=11370

Change-Id: Icf8d72c05b675447292d341a21a306316fc14ef4
Reviewed-on: http://gerrit.tine20.com/customers/2306
Tested-by: Jenkins CI (http://ci.tine20.com/)
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Tinebase/Controller/Record/Grants.php
tine20/Tinebase/Frontend/Cli.php

index b83398e..06e42ee 100644 (file)
@@ -56,11 +56,13 @@ abstract class Tinebase_Controller_Record_Grants extends Tinebase_Controller_Rec
      * @param Tinebase_Record_Interface $oldRecord
      * @return boolean
      * @throws Tinebase_Exception_AccessDenied
-     * 
-     * @todo allow to skip this (ignoreACL)
      */
     protected function _checkGrant($record, $action, $throw = true, $errorMessage = 'No Permission.', $oldRecord = null)
     {
+        if (! $this->_doContainerACLChecks) {
+            return TRUE;
+        }
+
         $hasGrant = parent::_checkGrant($record, $action, $throw, $errorMessage, $oldRecord);
         
         if (! $record->getId() || $action === 'create') {
index 294d219..4309c34 100644 (file)
@@ -837,8 +837,8 @@ class Tinebase_Frontend_Cli extends Tinebase_Frontend_Cli_Abstract
 
         // get all persistent filters without grants
         // TODO this could be enhanced by allowing to set default grants for other filters, too
-
-        $filters = Tinebase_PersistentFilter::getInstance()->search(new Tinebase_Model_PersistentFilterFilter());
+        Tinebase_PersistentFilter::getInstance()->doContainerACLChecks(false);
+        $filters = Tinebase_PersistentFilter::getInstance()->search(new Tinebase_Model_PersistentFilterFilter(array(),'', array('ignoreAcl' => true)));
         $filtersWithoutGrants = 0;
 
         foreach ($filters as $filter) {