mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 00:55:55 +00:00
Started on framework for RBAC/ABAC
This commit is contained in:
parent
528ebc93db
commit
c96adc85fc
3 changed files with 63 additions and 0 deletions
25
rbac/acl.go
Normal file
25
rbac/acl.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package rbac
|
||||
|
||||
import "google.golang.org/genproto/googleapis/type/datetime"
|
||||
|
||||
type ACLResource int32
|
||||
|
||||
const (
|
||||
Index ACLResource = iota
|
||||
)
|
||||
|
||||
type ACLAction int32
|
||||
|
||||
const (
|
||||
Read ACLAction = iota
|
||||
Write
|
||||
Update
|
||||
Grant
|
||||
)
|
||||
|
||||
type ACL struct {
|
||||
User *FBUser
|
||||
Resource ACLResource
|
||||
CreatedBy *FBUser
|
||||
Created datetime.DateTime
|
||||
}
|
||||
19
rbac/example.yaml
Normal file
19
rbac/example.yaml
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
---
|
||||
user:
|
||||
name: fletcher
|
||||
email: fletcher.haynes@featurebase.com
|
||||
|
||||
---
|
||||
group:
|
||||
name: employees
|
||||
members: [
|
||||
fletcher
|
||||
]
|
||||
|
||||
---
|
||||
role:
|
||||
name: administrators
|
||||
members: [
|
||||
fletcher
|
||||
]
|
||||
|
||||
19
rbac/user.go
Normal file
19
rbac/user.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package rbac
|
||||
|
||||
import "google.golang.org/genproto/googleapis/type/datetime"
|
||||
|
||||
type FBUserStatus int32
|
||||
|
||||
const (
|
||||
Active FBUserStatus = 0
|
||||
Disabled
|
||||
Locked
|
||||
)
|
||||
|
||||
type FBUser struct {
|
||||
Username string
|
||||
Email string
|
||||
Created datetime.DateTime
|
||||
LastActivity datetime.DateTime
|
||||
Status FBUserStatus
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue