OpenMarshal / npm-WebDAV-Server

WebDAV Server for npm
The Unlicense
256 stars 67 forks source link

Custom physical root path per user #58

Open s1rd4v3 opened 5 years ago

s1rd4v3 commented 5 years ago

Hi Guys,

i'm currently trying to marry Featherjs with your powerfull webdav-server. I already managed to use the feathers authentication system. but now i'm a little stuck with setting up a custom webdav root folder per user. What i need:

User Physical File System Webdav Folder
User A myAppPath/public/uploads/userA /
User B myAppPath/public/uploads/userB /

What i've tried so far:

The aim is, that the user that logs in, directly sees his main folder in the webdav root and doesn't have access to folders/files of other users at all.

btimby commented 4 years ago

A bit late, but I did a similar thing by implementing my own FileSystem class. This way you can look up the user's home directory and do all operations relative to that. I store user information in a cache so that multiple requests can reuse my fs state.

trmaphi commented 4 years ago

@btimby, did the Authentication class run every request? Where did you implement cache, in Authentication, or FileSystem?

btimby commented 4 years ago

@trmaphi I built a cache of user information attached to the filesystem, keyed by the basic auth header.

trmaphi commented 4 years ago

@btimby I far as I tested, I actually have to use https://github.com/OpenMarshal/npm-WebDAV-Server/pull/80 to get such as user info from context or did I miss something 😓.