mirror of
https://github.com/filebrowser/filebrowser.git
synced 2024-06-07 23:00:43 +00:00
Usign webdav
This commit is contained in:
parent
86b06b3f06
commit
509c59fc3f
@ -122,8 +122,6 @@ func Parse(c *caddy.Controller) ([]Config, error) {
|
||||
FileSystem: webdav.Dir(cfg.PathScope),
|
||||
LockSystem: webdav.NewMemLS(),
|
||||
}
|
||||
|
||||
// TODO
|
||||
case "show":
|
||||
if !c.NextArg() {
|
||||
return configs, c.ArgErr()
|
||||
|
@ -58,6 +58,23 @@ func (f FileManager) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, err
|
||||
}
|
||||
|
||||
if c.WebDav && strings.HasPrefix(r.URL.Path, c.WebDavURL) {
|
||||
url := strings.TrimPrefix(r.URL.Path, c.WebDavURL)
|
||||
|
||||
if !user.Allowed(url) {
|
||||
return http.StatusForbidden, nil
|
||||
}
|
||||
|
||||
switch r.Method {
|
||||
case "PROPPATCH", "MOVE", "PATCH", "PUT", "DELETE":
|
||||
if !user.AllowEdit {
|
||||
return http.StatusForbidden, nil
|
||||
}
|
||||
case "MKCOL", "COPY":
|
||||
if !user.AllowNew {
|
||||
return http.StatusForbidden, nil
|
||||
}
|
||||
}
|
||||
|
||||
c.WebDavHandler.ServeHTTP(w, r)
|
||||
return 0, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user