Hi Laoneo, Generally we consider this a bad idea. It goes against the spirit of HTTP and sabredav. However, your starting point is to create a virtual filesystem:
http://sabre.io/dav/virtual-filesystems/ Read that first and experiment with your own custom collection. Once you have a firm grasp on how this works, you should basically inject the authentication plugin into the constructor of your new collection, and alter the contents of the collection depending on who is currently logged in. Evert On Wednesday, November 12, 2014 6:00:54 AM UTC-5, Laoneo wrote: > > In my new application I want to have for every user it's own structure on > the server filesystem. Where do I start? Do I have to create my own backend > tree. And from what point on do I have access to the logged in user? My > server code looks as follows (simplified): > > $authBackend = new \Sabre\DAV\Auth\Backend\My(JFactory::getDbo()); > $calendarBackend = new \Sabre\CalDAV\Backend\PDO($pdo, $prefix . > 'a_calendars', $prefix . 'a_calendarobjects'); > $principalBackend = new \Sabre\DAVACL\PrincipalBackend\PDO($pdo, $prefix . > 'a_principals', $prefix . 'a_groupmembers'); > > $tree = array( > new Sabre\DAV\FS\Directory(ROOT . '/media/a/dav/data') > // new \Sabre\CalDAV\Principal\Collection($principalBackend), > // new \Sabre\CalDAV\CalendarRootNode($principalBackend, > // $calendarBackend) > ); > > \Sabre\DAV\Server::$exposeVersion = false; > > $server = new \Sabre\DAV\Server($tree); > > $lockBackend = new \Sabre\DAV\Locks\Backend\File(ROOT . > '/media/a/dav/locks'); > $lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend); > $server->addPlugin($lockPlugin); > > $server->addPlugin(new \Sabre\DAV\Auth\Plugin($authBackend, 'SabreDAV')); > $server->addPlugin(new \Sabre\DAVACL\Plugin()); > $server->addPlugin(new \Sabre\CalDAV\Plugin()); > > $server->addPlugin(new \Sabre\DAV\Browser\Plugin()); > > $server->exec(); > > As you can see, the tree root path is already set here. Can I set it > somehow afterwards, that the root is pointing to the users folder (eg. ROOT > . '/media/a/dav/data/jake'). > -- You received this message because you are subscribed to the Google Groups "SabreDAV Discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sabredav-discuss/d069b2b3-5cfd-47cc-8f27-51b918b21829%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
