/**
  * the singleton pattern
  *
  * @return Admin_Controller_Container
  */
 public static function getInstance()
 {
     if (self::$_instance === NULL) {
         self::$_instance = new Admin_Controller_Container();
     }
     return self::$_instance;
 }
 /**
  * set container grants
  * 
  * example usages: 
  * (1) $ php tine20.php --method=Calendar.setContainerGrants containerId=3339 accountId=15 accountType=group grants=readGrant
  * (2) $ php tine20.php --method=Timetracker.setContainerGrants namefilter="timeaccount name" accountId=15,30 accountType=group grants=book_own,manage_billable overwrite=1
  * 
  * @param Zend_Console_Getopt $_opts
  * @return boolean
  */
 public function setContainerGrants(Zend_Console_Getopt $_opts)
 {
     if (!$this->_checkAdminRight()) {
         return FALSE;
     }
     $data = $this->_parseArgs($_opts, array('accountId', 'grants'));
     $containers = $this->_getContainers($data);
     if (count($containers) == 0) {
         echo "No matching containers found.\n";
     } else {
         Admin_Controller_Container::getInstance()->setGrantsForContainers($containers, $data['grants'], $data['accountId'], isset($data['accountType']) || array_key_exists('accountType', $data) ? $data['accountType'] : Tinebase_Acl_Rights::ACCOUNT_TYPE_USER, (isset($data['overwrite']) || array_key_exists('overwrite', $data)) && $data['overwrite'] == '1');
         echo "Updated " . count($containers) . " container(s).\n";
     }
     return TRUE;
 }
示例#3
0
 /**
  * deletes existing records
  *
  * @param  array  $ids 
  * @return string
  */
 public function deleteContainers($ids)
 {
     return $this->_delete($ids, Admin_Controller_Container::getInstance());
 }
示例#4
0
 /**
  * Tears down the fixture
  * This method is called after a test is executed.
  *
  * @access protected
  */
 protected function tearDown()
 {
     // remove accounts for group member tests
     try {
         if (array_key_exists('user', $this->objects)) {
             Admin_Controller_User::getInstance()->delete($this->objects['user']->accountId);
         }
         if (array_key_exists('tag', $this->objects)) {
             Admin_Controller_Tags::getInstance()->delete($this->objects['tag']['id']);
         }
     } catch (Exception $e) {
         // do nothing
     }
     // remove container
     if (array_key_exists('container', $this->objects)) {
         Admin_Controller_Container::getInstance()->delete($this->objects['container']);
     }
 }