コード例 #1
0
ファイル: DAVServerTest.php プロジェクト: TamirAl/hubzilla
 function setUp()
 {
     $this->setUpBackends();
     $this->setUpTree();
     $this->server = new DAV\Server($this->tree);
     $this->server->debugExceptions = true;
     if ($this->setupCalDAV) {
         $this->caldavPlugin = new CalDAV\Plugin();
         $this->server->addPlugin($this->caldavPlugin);
     }
     if ($this->setupCalDAVSharing) {
         $this->caldavSharingPlugin = new CalDAV\SharingPlugin();
         $this->server->addPlugin($this->caldavSharingPlugin);
     }
     if ($this->setupCardDAV) {
         $this->carddavPlugin = new CardDAV\Plugin();
         $this->server->addPlugin($this->carddavPlugin);
     }
     if ($this->setupACL) {
         $this->aclPlugin = new DAVACL\Plugin();
         $this->server->addPlugin($this->aclPlugin);
     }
     if ($this->autoLogin) {
         $authBackend = new DAV\Auth\Backend\Mock();
         $authBackend->defaultUser = $this->autoLogin;
         $this->authPlugin = new DAV\Auth\Plugin($authBackend, 'SabreDAV');
         $this->server->addPlugin($this->authPlugin);
         // This will trigger the actual login procedure
         $this->authPlugin->beforeMethod('OPTIONS', '/');
     }
 }
コード例 #2
0
ファイル: DAVServerTest.php プロジェクト: BlaBlaNet/hubzilla
 /**
  * This function takes a username and sets the server in a state where
  * this user is logged in, and no longer requires an authentication check.
  *
  * @param string $userName
  */
 function autoLogin($userName)
 {
     $authBackend = new DAV\Auth\Backend\Mock();
     $authBackend->setPrincipal('principals/' . $userName);
     $this->authPlugin = new DAV\Auth\Plugin($authBackend);
     // If the auth plugin already exists, we're removing its hooks:
     if ($oldAuth = $this->server->getPlugin('auth')) {
         $this->server->removeListener('beforeMethod', [$oldAuth, 'beforeMethod']);
     }
     $this->server->addPlugin($this->authPlugin);
     // This will trigger the actual login procedure
     $this->authPlugin->beforeMethod(new Request(), new Response());
 }
コード例 #3
0
 function setUp()
 {
     $this->setUpBackends();
     $this->setUpTree();
     $this->server = new DAV\Server($this->tree);
     $this->server->sapi = new HTTP\SapiMock();
     $this->server->debugExceptions = true;
     if ($this->setupCalDAV) {
         $this->caldavPlugin = new CalDAV\Plugin();
         $this->server->addPlugin($this->caldavPlugin);
     }
     if ($this->setupCalDAVSharing) {
         $this->caldavSharingPlugin = new CalDAV\SharingPlugin();
         $this->server->addPlugin($this->caldavSharingPlugin);
     }
     if ($this->setupCalDAVScheduling) {
         $this->caldavSchedulePlugin = new CalDAV\Schedule\Plugin();
         $this->server->addPlugin($this->caldavSchedulePlugin);
     }
     if ($this->setupCalDAVSubscriptions) {
         $this->server->addPlugin(new CalDAV\Subscriptions\Plugin());
     }
     if ($this->setupCalDAVICSExport) {
         $this->caldavICSExportPlugin = new CalDAV\ICSExportPlugin();
         $this->server->addPlugin($this->caldavICSExportPlugin);
     }
     if ($this->setupCardDAV) {
         $this->carddavPlugin = new CardDAV\Plugin();
         $this->server->addPlugin($this->carddavPlugin);
     }
     if ($this->setupACL) {
         $this->aclPlugin = new DAVACL\Plugin();
         $this->server->addPlugin($this->aclPlugin);
     }
     if ($this->setupLocks) {
         $this->locksPlugin = new DAV\Locks\Plugin($this->locksBackend);
         $this->server->addPlugin($this->locksPlugin);
     }
     if ($this->setupPropertyStorage) {
         $this->propertyStoragePlugin = new DAV\PropertyStorage\Plugin($this->propertyStorageBackend);
         $this->server->addPlugin($this->propertyStoragePlugin);
     }
     if ($this->autoLogin) {
         $authBackend = new DAV\Auth\Backend\Mock();
         $authBackend->setPrincipal('principals/' . $this->autoLogin);
         $this->authPlugin = new DAV\Auth\Plugin($authBackend);
         $this->server->addPlugin($this->authPlugin);
         // This will trigger the actual login procedure
         $this->authPlugin->beforeMethod(new Request(), new Response());
     }
 }