/**
  * add one record
  *
  * @param   Tinebase_Record_Interface $_record
  * @return  Tinebase_Record_Interface
  */
 public function create(Tinebase_Record_Interface $_record)
 {
     $this->_checkRight('create');
     $_record->account_grants = $this->_convertGrantsToRecordSet($_record->account_grants);
     Tinebase_Container::getInstance()->checkContainerOwner($_record);
     Tinebase_Timemachine_ModificationLog::setRecordMetaData($_record, 'create');
     $container = $this->_containerController->addContainer($_record, $_record->account_grants, TRUE);
     $container->account_grants = $this->_containerController->getGrantsOfContainer($container, TRUE);
     return $container;
 }
 /**
  * try to get all grants of a container
  *
  */
 public function testGetGrantsOfContainer()
 {
     $this->assertTrue($this->_instance->hasGrant(Tinebase_Core::getUser(), $this->objects['initialContainer'], Tinebase_Model_Grants::GRANT_READ));
     $grants = $this->_instance->getGrantsOfContainer($this->objects['initialContainer']);
     $this->assertEquals('Tinebase_Record_RecordSet', get_class($grants), 'wrong type');
     $grants = $grants->toArray();
     $this->assertTrue($grants[0]["readGrant"]);
     $this->assertTrue($grants[0]["addGrant"]);
     $this->assertTrue($grants[0]["editGrant"]);
     $this->assertTrue($grants[0]["deleteGrant"]);
     $this->assertTrue($grants[0]["adminGrant"]);
     $this->_instance->deleteContainer($this->objects['initialContainer']);
     $this->setExpectedException('Tinebase_Exception_NotFound');
     $container = $this->_instance->getContainerById($this->objects['initialContainer']);
 }