mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: implement acl for workspaces (#19094)
This commit is contained in:
@@ -77,6 +77,28 @@ func (t TemplateACL) Value() (driver.Value, error) {
|
||||
return json.Marshal(t)
|
||||
}
|
||||
|
||||
type WorkspaceACL map[string]WorkspaceACLEntry
|
||||
|
||||
func (t *WorkspaceACL) Scan(src interface{}) error {
|
||||
switch v := src.(type) {
|
||||
case string:
|
||||
return json.Unmarshal([]byte(v), &t)
|
||||
case []byte, json.RawMessage:
|
||||
//nolint
|
||||
return json.Unmarshal(v.([]byte), &t)
|
||||
}
|
||||
|
||||
return xerrors.Errorf("unexpected type %T", src)
|
||||
}
|
||||
|
||||
func (t WorkspaceACL) Value() (driver.Value, error) {
|
||||
return json.Marshal(t)
|
||||
}
|
||||
|
||||
type WorkspaceACLEntry struct {
|
||||
Permissions []policy.Action `json:"permissions"`
|
||||
}
|
||||
|
||||
type ExternalAuthProvider struct {
|
||||
ID string `json:"id"`
|
||||
Optional bool `json:"optional,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user