forked from influxdata/influxdb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_manager.go
35 lines (33 loc) · 2.02 KB
/
user_manager.go
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
28
29
30
31
32
33
34
35
package http
import (
"github.com/influxdb/influxdb/common"
)
type UserManager interface {
// Returns the user for the given db and that has the given
// credentials, falling back to cluster admins
AuthenticateDbUser(db, username, password string) (common.User, error)
// Returns the cluster admin with the given credentials
AuthenticateClusterAdmin(username, password string) (common.User, error)
// Create a cluster admin user, it's an error if requester isn't a cluster admin
CreateClusterAdminUser(request common.User, username, password string) error
// Delete a cluster admin. Same restrictions as CreateClusterAdminUser
DeleteClusterAdminUser(requester common.User, username string) error
// Change cluster admin's password. It's an error if requester isn't a cluster admin
ChangeClusterAdminPassword(requester common.User, username, password string) error
// list cluster admins. only a cluster admin can list the other cluster admins
ListClusterAdmins(requester common.User) ([]string, error)
// Create a db user, it's an error if requester isn't a db admin or cluster admin
CreateDbUser(request common.User, db, username, password string, permissions ...string) error
// Delete a db user. Same restrictions apply as in CreateDbUser
DeleteDbUser(requester common.User, db, username string) error
// Change db user's password. It's an error if requester isn't a cluster admin or db admin
ChangeDbUserPassword(requester common.User, db, username, password string) error
ChangeDbUserPermissions(requester common.User, db, username, readPermissions, writePermissions string) error
// list cluster admins. only a cluster admin or the db admin can list the db users
ListDbUsers(requester common.User, db string) ([]common.User, error)
GetDbUser(requester common.User, db, username string) (common.User, error)
// make user a db admin for 'db'. It's an error if the requester
// isn't a db admin or cluster admin or if user isn't a db user
// for the given db
SetDbAdmin(requester common.User, db, username string, isAdmin bool) error
}