I am trying to setup a very simple carrdav server withing my web directory as described
My directory struction is like
root
-- www
-- carddav
--- vendor
...
--- carddav.php
-- data (drwxrwxrwx)
carddav.sqlite
my carddav.php code is from the examples
<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
date_default_timezone_set('Canada/Eastern');
// Make sure this setting is turned on and reflect the root url for your WebDAV server.
// This can be for example the root / or a complete path to your server script
$baseUri = '/carddav/carddav.php/';
/* Database */
$pdo = new PDO('sqlite:../../data/carddav.sqlite');
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
require_once 'vendor/autoload.php';
// Backends
$authBackend = new Sabre\DAV\Auth\Backend\PDO($pdo);
$principalBackend = new Sabre\DAVACL\PrincipalBackend\PDO($pdo);
$carddavBackend = new Sabre\CardDAV\Backend\PDO($pdo);
// Setting up the directory tree //
$nodes = [
new Sabre\DAVACL\PrincipalCollection($principalBackend),
new Sabre\CardDAV\AddressBookRoot($principalBackend, $carddavBackend),
];
// The object tree needs in turn to be passed to the server class
$server = new Sabre\DAV\Server($nodes);
$server->setBaseUri($baseUri);
// Plugins
$server->addPlugin(new Sabre\DAV\Auth\Plugin($authBackend));
$server->addPlugin(new Sabre\DAV\Browser\Plugin());
//$server->addPlugin(new Sabre\CalDAV\Plugin());
$server->addPlugin(new Sabre\CardDAV\Plugin());
$server->addPlugin(new Sabre\DAVACL\Plugin());
$server->addPlugin(new Sabre\DAV\Sync\Plugin());
// And off we go!
$server->start();
I run this with
php -S 127.0.0.1:8000. from the www directory
If I go to
http://127.0.0.1:8000/carddav/carddav.php
I can loging as admin/admin
If I go to addressbooks and try to create a folder I see
<d:error>
<s:sabredav-version>4.6.0</s:sabredav-version>
<s:exception>Sabre\DAV\Exception\Forbidden</s:exception>
<s:message>Permission denied to create directory</s:message>
Also if I go to the principals page and try to create a new principals I see
<d:error>
<s:sabredav-version>4.6.0</s:sabredav-version>
<s:exception>Sabre\DAVACL\Exception\NeedPrivileges</s:exception>
<s:message>
User did not have the required privileges ({DAV:}bind) for path "principals"
</s:message>
<d:need-privileges>
<d:resource>
<d:href>/carddav/carddav.php/principals</d:href>
<d:privilege>
<d:bind/>
</d:privilege>
</d:resource>
</d:need-privileges>
</d:error>
</d:error>
Any idea why I don’t have permissions to do anything even though an admin. The folder permission are liberal and the php server should be running as my user ?
Also can I increase the debugging from Sabre ?
this is Mac OSX if it makes a difference.
Thanks
You need to sign in to view this answers
Leave feedback about this