mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: add auditing for groups (#4527)
- Clean up `database.TemplateACL` implementation.
This commit is contained in:
@@ -24,3 +24,22 @@ func (a *Actions) Scan(src interface{}) error {
|
||||
func (a *Actions) Value() (driver.Value, error) {
|
||||
return json.Marshal(a)
|
||||
}
|
||||
|
||||
// TemplateACL is a map of ids to permissions.
|
||||
type TemplateACL map[string][]rbac.Action
|
||||
|
||||
func (t *TemplateACL) 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 TemplateACL) Value() (driver.Value, error) {
|
||||
return json.Marshal(t)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user