2019-07-19 23:04:50 +00:00
|
|
|
package mock
|
|
|
|
|
|
|
|
import (
|
2020-04-03 17:39:20 +00:00
|
|
|
platform "github.com/influxdata/influxdb/v2"
|
2019-07-19 23:04:50 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// Authorization is an Authorizer that always allows everything
|
|
|
|
type Authorization struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
func (Authorization) Allowed(p platform.Permission) bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
func (Authorization) Identifier() platform.ID {
|
|
|
|
return mustID("beefdeaddeadbeef")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (Authorization) GetUserID() platform.ID {
|
|
|
|
return mustID("deadbeefbeefdead")
|
|
|
|
}
|
|
|
|
|
|
|
|
func (Authorization) Kind() string {
|
|
|
|
return "mock-authorizer"
|
|
|
|
}
|
|
|
|
|
|
|
|
func mustID(str string) platform.ID {
|
|
|
|
id, err := platform.IDFromString(str)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
return *id
|
|
|
|
}
|