mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: Auditing group members as part of group resource (#5730)
* added AuditableGroup type * added json tags * Anonymizing gGroup struct * adding support on the FE for nested group diffs * added type for GroupMember * Update coderd/database/modelmethods.go Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com> * Update coderd/database/modelmethods.go Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com> * fetching group members in group.delete * passing through right error * broke out into util function and added tests Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
This commit is contained in:
co-authored by
Steven Masley
parent
56b996532f
commit
6b68fbbf18
@@ -16,8 +16,8 @@ type Auditable interface {
|
||||
database.User |
|
||||
database.Workspace |
|
||||
database.GitSSHKey |
|
||||
database.Group |
|
||||
database.WorkspaceBuild
|
||||
database.WorkspaceBuild |
|
||||
database.AuditableGroup
|
||||
}
|
||||
|
||||
// Map is a map of changed fields in an audited resource. It maps field names to
|
||||
|
||||
@@ -64,8 +64,8 @@ func ResourceTarget[T Auditable](tgt T) string {
|
||||
return ""
|
||||
case database.GitSSHKey:
|
||||
return typed.PublicKey
|
||||
case database.Group:
|
||||
return typed.Name
|
||||
case database.AuditableGroup:
|
||||
return typed.Group.Name
|
||||
default:
|
||||
panic(fmt.Sprintf("unknown resource %T", tgt))
|
||||
}
|
||||
@@ -87,8 +87,8 @@ func ResourceID[T Auditable](tgt T) uuid.UUID {
|
||||
return typed.ID
|
||||
case database.GitSSHKey:
|
||||
return typed.UserID
|
||||
case database.Group:
|
||||
return typed.ID
|
||||
case database.AuditableGroup:
|
||||
return typed.Group.ID
|
||||
default:
|
||||
panic(fmt.Sprintf("unknown resource %T", tgt))
|
||||
}
|
||||
@@ -110,7 +110,7 @@ func ResourceType[T Auditable](tgt T) database.ResourceType {
|
||||
return database.ResourceTypeWorkspaceBuild
|
||||
case database.GitSSHKey:
|
||||
return database.ResourceTypeGitSshKey
|
||||
case database.Group:
|
||||
case database.AuditableGroup:
|
||||
return database.ResourceTypeGroup
|
||||
default:
|
||||
panic(fmt.Sprintf("unknown resource %T", tgt))
|
||||
|
||||
Reference in New Issue
Block a user