Closed underlaw closed 2 years ago
Depends on how you're authenticating users and such. What is your config / what have you tried so far?
thx
:2333 { encode gzip basicauth { underlaw JDJhJDE0JDI1OUJCR3VndzBWUWtSU3ZsdVJXUGVrLzlsV0M2N3AuN2taRmkvY2ZnMlVIR1VtZnE4bjN5 test JDJhJDE0JDI1OUJCR3VndzBWUWtSU3ZsdVJXUGVrLzlsV0M2N3AuN2taRmkvY2ZnMlVIR1VtZnE4bjN5 } root * /mnt/sda1/movie
route { rewrite /webdav /webdav/ webdav /webdav/* { prefix /webdav } file_server browse } }
underlaw has read, write, edit and delete permission; test has only read permission.
how to do? thx
You could probably use something like:
@forbidWrite {
vars http.auth.user.id test
not method GET HEAD OPTIONS PROPFIND
}
handle @forbidWrite {
respond "Not allowed" 403
}
handle {
# everything else
}
Are you talking about setting different shared folders for different users? This is different from what I want. I want the same shared folder, but different users have different permissions. Thank you
I mean: the shared folder is /mnt/sda1/movie, undelaw has read-write permission, and test only has read permission.
No, that's disallowing writes for the user named test
.
With further questions, please try asking on our forums! https://caddy.community
No, that's disallowing writes for the user named
test
.With further questions, please try asking on our forums! https://caddy.community
But it also disallow read files from server on applications that support webdav when test
remove method PROPFIND
.
And it retains method PROPFIND
, test
can delete files from server.
Just want to share friends with accounts and not to modify files on server.
Came here to say thank you @mholt - this is the only solution that works here - I can see files but not modify them.
EDIT: ah well, adding a second user actually has got the same behavior as guest
. I cannot read/write. It is a pity cause this seems the only way to do this, I'll have to ask on the forum.
with this conf:
:8080 {
rewrite /dav /dav/
# Thank you mholt for this solution:
# https://github.com/mholt/caddy-webdav/issues/27
@noGuestsWrite {
vars http.auth.user.id guest
not method GET HEAD OPTIONS PROPFIND
}
handle @noGuestsWrite {
respond 403
}
handle {
basicauth /dav/media {
guest <XYZ>
}
webdav /dav/* {
root /srv/http/dav/All
prefix /dav/media
}
file_server
}
}
For example, user 1 has read, write, edit and delete permission, while user 2 has only read permission.