Skip to content

Commit 00a7c3f

Browse files
committed
WIP: start work on SVO
1 parent e977e84 commit 00a7c3f

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed

coderd/authz/object.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package authz
2+
3+
// Object is the resource being accessed
4+
type Object struct {
5+
ObjectID string `json:"object_id"`
6+
OwnerID string `json:"owner_id"`
7+
OrgOwnerID string `json:"org_owner_id"`
8+
9+
// ObjectType is "workspace", "project", "devurl", etc
10+
ObjectType ResourceType `json:"object_type"`
11+
// TODO: SharedUsers?
12+
}

coderd/authz/resources.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package authz
2+
3+
type ResourceType string
4+
5+
const (
6+
ResourceTypeWorkspace = "workspace"
7+
ResourceTypeProject = "project"
8+
ResourceTypeDevURL = "devurl"
9+
)

coderd/authz/subject.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package authz
2+
3+
//
4+
//// Subject is the actor that is performing the action on an object
5+
//type Subject struct {
6+
// UserID string `json:"user_id"`
7+
//
8+
// SiteRoles []Role `json:"site_roles"`
9+
//
10+
// // Ops are mapped for the resource and the list of operations on the resource for the scope.
11+
// SiteOps []Permission `json:"site_ops"`
12+
// OrgOps []Permission `json:"org_ops"`
13+
// // UserOps only affect objects owned by the user
14+
// UserOps []Permission `json:"user_ops"`
15+
//}
16+
//
17+
//func (s Subject) AllPermissions() []Permission{
18+
// // Explosion of roles + scopes
19+
// return []Permission{}
20+
//}
21+
//
22+
//// Authn
23+
//type S struct {
24+
// SiteRoles() ([]rbac.Roles, error)
25+
// OrgRoles(ctx context.Context, orgID string) ([]rbac.Roles, error)
26+
// UserRoles() ([]rbac.Roles, error)
27+
// Scopes() ([]rbac.ResourcePermission, error)
28+
//}

0 commit comments

Comments
 (0)