Example #1
0
 function setup()
 {
     if (!SABRE_HASSQLITE) {
         $this->markTestSkipped('No PDO SQLite support');
     }
     $this->caldavBackend = Sabre_CalDAV_TestUtil::getBackend();
     $principalBackend = new Sabre_DAVACL_MockPrincipalBackend();
     $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-read', array('principals/user1'));
     $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-write', array('principals/user1'));
     $principalBackend->addPrincipal(array('uri' => 'principals/admin/calendar-proxy-read'));
     $principalBackend->addPrincipal(array('uri' => 'principals/admin/calendar-proxy-write'));
     $calendars = new Sabre_CalDAV_CalendarRootNode($principalBackend, $this->caldavBackend);
     $principals = new Sabre_CalDAV_Principal_Collection($principalBackend);
     $root = new Sabre_DAV_SimpleCollection('root');
     $root->addChild($calendars);
     $root->addChild($principals);
     $objectTree = new Sabre_DAV_ObjectTree($root);
     $this->server = new Sabre_DAV_Server($objectTree);
     $this->server->debugExceptions = true;
     $this->server->setBaseUri('/');
     $this->plugin = new Sabre_CalDAV_Plugin();
     $this->server->addPlugin($this->plugin);
     $this->response = new Sabre_HTTP_ResponseMock();
     $this->server->httpResponse = $this->response;
 }
Example #2
0
 function setup()
 {
     $this->caldavBackend = new Sabre_CalDAV_Backend_Mock(array(array('id' => 1, 'uri' => 'UUID-123467', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'user1 calendar', '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description', '{http://apple.com/ns/ical/}calendar-order' => '1', '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT', 'VTODO'))), array('id' => 2, 'uri' => 'UUID-123468', 'principaluri' => 'principals/user1', '{DAV:}displayname' => 'user1 calendar2', '{urn:ietf:params:xml:ns:caldav}calendar-description' => 'Calendar description', '{http://apple.com/ns/ical/}calendar-order' => '1', '{http://apple.com/ns/ical/}calendar-color' => '#FF0000', '{urn:ietf:params:xml:ns:caldav}supported-calendar-component-set' => new Sabre_CalDAV_Property_SupportedCalendarComponentSet(array('VEVENT', 'VTODO')))), array(1 => array('UUID-2345' => array('calendardata' => Sabre_CalDAV_TestUtil::getTestCalendarData()))));
     $principalBackend = new Sabre_DAVACL_MockPrincipalBackend();
     $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-read', array('principals/user1'));
     $principalBackend->setGroupMemberSet('principals/admin/calendar-proxy-write', array('principals/user1'));
     $principalBackend->addPrincipal(array('uri' => 'principals/admin/calendar-proxy-read'));
     $principalBackend->addPrincipal(array('uri' => 'principals/admin/calendar-proxy-write'));
     $calendars = new Sabre_CalDAV_CalendarRootNode($principalBackend, $this->caldavBackend);
     $principals = new Sabre_CalDAV_Principal_Collection($principalBackend);
     $root = new Sabre_DAV_SimpleCollection('root');
     $root->addChild($calendars);
     $root->addChild($principals);
     $objectTree = new Sabre_DAV_ObjectTree($root);
     $this->server = new Sabre_DAV_Server($objectTree);
     $this->server->debugExceptions = true;
     $this->server->setBaseUri('/');
     $this->plugin = new Sabre_CalDAV_Plugin();
     $this->server->addPlugin($this->plugin);
     // Adding ACL plugin
     $this->server->addPlugin(new Sabre_DAVACL_Plugin());
     // Adding Auth plugin, and ensuring that we are logged in.
     $authBackend = new Sabre_DAV_Auth_MockBackend();
     $authBackend->defaultUser = '******';
     $authPlugin = new Sabre_DAV_Auth_Plugin($authBackend, 'SabreDAV');
     $this->server->addPlugin($authPlugin);
     $authPlugin->beforeMethod('GET', '/');
     $this->response = new Sabre_HTTP_ResponseMock();
     $this->server->httpResponse = $this->response;
 }
 function getServer()
 {
     $backend = new Sabre_DAVACL_MockPrincipalBackend();
     $dir = new Sabre_DAV_SimpleCollection('root');
     $principals = new Sabre_DAVACL_PrincipalCollection($backend);
     $dir->addChild($principals);
     $fakeServer = new Sabre_DAV_Server(new Sabre_DAV_ObjectTree($dir));
     $fakeServer->httpResponse = new Sabre_HTTP_ResponseMock();
     $plugin = new Sabre_DAVACL_Plugin($backend, 'realm');
     $this->assertTrue($plugin instanceof Sabre_DAVACL_Plugin);
     $fakeServer->addPlugin($plugin);
     $this->assertEquals($plugin, $fakeServer->getPlugin('acl'));
     return $fakeServer;
 }
Example #4
0
 public function __construct()
 {
     $caldavChildren = array();
     $carddavChildren = array();
     $webdavChildren = array();
     if (Tinebase_Core::getUser()->hasRight('Calendar', Tinebase_Acl_Rights::RUN)) {
         $caldavChildren[] = new Calendar_Frontend_CalDAV();
     }
     if (Tinebase_Core::getUser()->hasRight('Addressbook', Tinebase_Acl_Rights::RUN)) {
         $carddavChildren[] = new Addressbook_Frontend_CardDAV();
     }
     foreach (array('Addressbook', 'Calendar', 'Filemanager') as $application) {
         if (Tinebase_Core::getUser()->hasRight($application, Tinebase_Acl_Rights::RUN)) {
             $applicationClass = $application . '_Frontend_WebDAV';
             $webdavChildren[] = new $applicationClass($application);
         }
     }
     parent::__construct('root', array(new Sabre_DAV_SimpleCollection(Sabre_CardDAV_Plugin::ADDRESSBOOK_ROOT, $carddavChildren), new Sabre_DAV_SimpleCollection(Sabre_CalDAV_Plugin::CALENDAR_ROOT, $caldavChildren), new Sabre_DAV_SimpleCollection('webdav', $webdavChildren), new Sabre_DAV_SimpleCollection('principals', array(new Sabre_DAVACL_PrincipalCollection(new Tinebase_WebDav_PrincipalBackend(), 'principals/users'), new Sabre_DAVACL_PrincipalCollection(new Tinebase_WebDav_PrincipalBackend(), 'principals/groups')))));
 }
Example #5
0
 function __construct($type)
 {
     $this->type = $type;
     parent::__construct('root');
 }
 /**
  * @depends testSimpleDirectoryConstruct
  * @expectedException Sabre_DAV_Exception_NotFound
  */
 public function testSimpleDirectoryGetChild404()
 {
     $dir = new Sabre_DAV_SimpleCollection('simpledir');
     $dir->getChild('blabla');
 }
Example #7
0
 function getChild($name)
 {
     if (isset($this->newDirectories[$name])) {
         return new Sabre_DAV_TreeDirectoryTester($name);
     }
     if (isset($this->newFiles[$name])) {
         return new Sabre_DAV_TreeFileTester($name, $this->newFiles[$name]);
     }
     return parent::getChild($name);
 }