Hi everyone, I wrote new docs for this. It takes the previous threads and goes into a lot more detail on how to solve this issue.
It's possible that it's vague in some areas, so I would also love to hear if there are bits you don't understand/I didn't explain well enough. Evert On Monday, December 1, 2014 12:22:56 PM UTC-5, Evert Pot wrote: > > Hi guys, > > That question was asked and answered a few times before: > > https://groups.google.com/forum/#!topic/sabredav-discuss/MjJ0lWdaFvc > > https://groups.google.com/forum/#!searchin/sabredav-discuss/getCurrentUSer/sabredav-discuss/k9RvApCtG8k/4zuIa8YJJ1MJ > > This issue seems to be common enough to add a FAQ entry for though, so I > will try to make some time today to take those discussions and turn them > into a good documentation page. > > Evert > > On Monday, December 1, 2014 12:17:49 PM UTC-5, paranerd wrote: >> >> 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/5580899b-d84e-4899-ad88-eed7e8737b1f%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
