Found a possible solution:

use
    Sabre\HTTP\Sapi,
    Sabre\HTTP\Response,
    Sabre\HTTP\Auth;

$request = Sapi::getRequest();
$response = new Response();

$basicAuth = new Auth\Basic("Locked down area", $request, $response);
$basicAuth->requireLogin();
$user = $basicAuth->getCredentials();

$username = $user[0];
$password = $user[1];

Put that at the beginning of your script so you can set the proper path to
each user directory.

2014-12-01 11:38 GMT+01:00 paranerd <[email protected]>:

> Currently having the same issue...
>
> This is what I got:
>
> $path = "";
> $authBackend = new
> Sabre\DAV\Auth\Backend\BasicCallBack(function($userName, $password) {
> if(login($userName, $password)) {
> $path = $dataDir . $userName;
> return true;
> }
> return false;
> });
>
> $root = new \Sabre\DAV\FS\Directory($path);
> [..]
>
> The problem is, that the "$root"-part gets called BEFORE the
> "$authBackend"-Part, so I get an error, that the $path can not be empty =/
>
> Is there a "getUser()"-function or a way to get the functions to be called
> in the "right" order?
>
> Thanks in advance.
>
> Am Samstag, 29. November 2014 17:55:29 UTC+1 schrieb Bailey Rud:
>>
>> Hello,
>>
>> I currently develop an application with a webdav-server. Each user have
>> their own home directory with their files. My webdav-server (based on
>> SabreDAV) runs with authentication, but i don't know how to use the
>> username of the authentication for the direcory. For example: when the user
>> "test2" logins, the directory in webdav should be "/files/test2/".
>> Is this possible? When yes, how can i realize that in PHP?
>>
>> Thank you for your help and sorry for my bad english (i'm from germany),
>> Bailey
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "SabreDAV Discussion" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sabredav-discuss/3LovqGsfZ00/unsubscribe
> .
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sabredav-discuss/9393ef87-6f31-4615-9661-796de6d08977%40googlegroups.com
> <https://groups.google.com/d/msgid/sabredav-discuss/9393ef87-6f31-4615-9661-796de6d08977%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CACx7Ny7D9XNAgnBLg5-8EqPLYJVFCgmMkfxwqMKVqYwwKhBRGg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to