s
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package common
|
||||
|
||||
type Perm string
|
||||
|
||||
const (
|
||||
PermRead Perm = "read"
|
||||
PermWrite Perm = "write"
|
||||
PermAdmin Perm = "admin"
|
||||
)
|
||||
|
||||
// PermRank gives perm a hierarchy for implication checks: a grant of rank N
|
||||
// satisfies a request of rank <= N.
|
||||
func (perm Perm) PermRank() int {
|
||||
switch perm {
|
||||
case PermAdmin:
|
||||
return 3
|
||||
case PermWrite:
|
||||
return 2
|
||||
default:
|
||||
return 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user