Started on framework for RBAC/ABAC

This commit is contained in:
Fletcher Haynes 2023-02-23 16:05:55 -08:00
parent 528ebc93db
commit c96adc85fc
3 changed files with 63 additions and 0 deletions

25
rbac/acl.go Normal file
View 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
View 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
View 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
}