-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmethods.go
More file actions
27 lines (24 loc) · 892 Bytes
/
Copy pathmethods.go
File metadata and controls
27 lines (24 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package permission
var (
aliases = map[string][]string{
"ro": []string{"GET", "HEAD", "PROPFIND", "OPTIONS", "LOCK", "UNLOCK"},
"rw": []string{"GET", "HEAD", "PROPFIND", "OPTIONS", "LOCK", "UNLOCK", "POST", "PUT", "DELETE", "MKCOL", "PROPPATCH"},
"ws": []string{"WEBSOCKET"},
}
)
// MethodIsRo returns whether the supplied method is a "read only" method.
func MethodIsRo(method string) bool {
switch method {
case "GET", "HEAD", "PROPFIND", "OPTIONS", "LOCK", "UNLOCK":
return true
}
return false
}
// special methods:
// MOVE: check DELETE on source and PUT on dest
// COPY: check GET on source and PUT on dest
// WEBSOCKET: check if Upgrade Header is present
// PATCH: treated as special if "Destination" Header is present:
// like COPY if Header "Action: copy" is present, else
// like MOVE
// (this behaviour was observed in https://github.com/hacdias/filemanager)