Skip to content
Prev Previous commit
Next Next commit
running make cmd
  • Loading branch information
Kira-Pilot committed Jan 26, 2023
commit f96cbe3dcbe4302fa3434d37647823856385806d
18 changes: 9 additions & 9 deletions docs/admin/audit-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ We track the following resources:

| <b>Resource<b> | |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| AuditableGroup | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>name</td><td>true</td></tr><tr><td>organization_id</td><td>false</td></tr><tr><td>avatar_url</td><td>true</td></tr><tr><td>quota_allowance</td><td>true</td></tr><tr><td>members</td><td>true</td></tr><tr><td>id</td><td>true</td></tr></tbody></table> |
| GitSSHKey | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>public_key</td><td>true</td></tr><tr><td>user_id</td><td>true</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>private_key</td><td>true</td></tr></tbody></table> |
| Organization | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>updated_at</td><td>false</td></tr><tr><td>id</td><td>true</td></tr><tr><td>name</td><td>true</td></tr><tr><td>description</td><td>true</td></tr><tr><td>created_at</td><td>false</td></tr></tbody></table> |
| OrganizationMember | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>created_at</td><td>false</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>roles</td><td>true</td></tr><tr><td>user_id</td><td>true</td></tr><tr><td>organization_id</td><td>true</td></tr></tbody></table> |
| Template | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>min_autostart_interval</td><td>true</td></tr><tr><td>created_by</td><td>true</td></tr><tr><td>allow_user_cancel_workspace_jobs</td><td>true</td></tr><tr><td>id</td><td>true</td></tr><tr><td>active_version_id</td><td>true</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>deleted</td><td>false</td></tr><tr><td>default_ttl</td><td>true</td></tr><tr><td>is_private</td><td>true</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>provisioner</td><td>true</td></tr><tr><td>group_acl</td><td>true</td></tr><tr><td>description</td><td>true</td></tr><tr><td>user_acl</td><td>true</td></tr><tr><td>organization_id</td><td>false</td></tr><tr><td>name</td><td>true</td></tr><tr><td>display_name</td><td>true</td></tr><tr><td>icon</td><td>true</td></tr></tbody></table> |
| TemplateVersion | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>readme</td><td>true</td></tr><tr><td>name</td><td>true</td></tr><tr><td>organization_id</td><td>false</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>template_id</td><td>true</td></tr><tr><td>job_id</td><td>false</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>created_by</td><td>true</td></tr><tr><td>id</td><td>true</td></tr></tbody></table> |
| User | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>status</td><td>true</td></tr><tr><td>avatar_url</td><td>false</td></tr><tr><td>login_type</td><td>false</td></tr><tr><td>last_seen_at</td><td>false</td></tr><tr><td>email</td><td>true</td></tr><tr><td>username</td><td>true</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>rbac_roles</td><td>true</td></tr><tr><td>hashed_password</td><td>true</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>deleted</td><td>true</td></tr><tr><td>id</td><td>true</td></tr></tbody></table> |
| Workspace | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>autostart_schedule</td><td>true</td></tr><tr><td>ttl</td><td>true</td></tr><tr><td>last_used_at</td><td>false</td></tr><tr><td>id</td><td>true</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>organization_id</td><td>false</td></tr><tr><td>template_id</td><td>true</td></tr><tr><td>deleted</td><td>false</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>owner_id</td><td>true</td></tr><tr><td>name</td><td>true</td></tr></tbody></table> |
| WorkspaceBuild | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>deadline</td><td>false</td></tr><tr><td>id</td><td>false</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>build_number</td><td>false</td></tr><tr><td>job_id</td><td>false</td></tr><tr><td>template_version_id</td><td>true</td></tr><tr><td>transition</td><td>false</td></tr><tr><td>provisioner_state</td><td>false</td></tr><tr><td>reason</td><td>false</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>daily_cost</td><td>false</td></tr><tr><td>workspace_id</td><td>false</td></tr><tr><td>initiator_id</td><td>false</td></tr></tbody></table> |
| AuditableGroup | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>organization_id</td><td>false</td></tr><tr><td>avatar_url</td><td>true</td></tr><tr><td>quota_allowance</td><td>true</td></tr><tr><td>members</td><td>true</td></tr><tr><td>id</td><td>true</td></tr><tr><td>name</td><td>true</td></tr></tbody></table> |
| GitSSHKey | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>private_key</td><td>true</td></tr><tr><td>public_key</td><td>true</td></tr><tr><td>user_id</td><td>true</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>updated_at</td><td>false</td></tr></tbody></table> |
| Organization | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>created_at</td><td>false</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>id</td><td>true</td></tr><tr><td>name</td><td>true</td></tr><tr><td>description</td><td>true</td></tr></tbody></table> |
| OrganizationMember | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>user_id</td><td>true</td></tr><tr><td>organization_id</td><td>true</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>roles</td><td>true</td></tr></tbody></table> |
| Template | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>min_autostart_interval</td><td>true</td></tr><tr><td>organization_id</td><td>false</td></tr><tr><td>allow_user_cancel_workspace_jobs</td><td>true</td></tr><tr><td>active_version_id</td><td>true</td></tr><tr><td>is_private</td><td>true</td></tr><tr><td>deleted</td><td>false</td></tr><tr><td>default_ttl</td><td>true</td></tr><tr><td>user_acl</td><td>true</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>icon</td><td>true</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>name</td><td>true</td></tr><tr><td>display_name</td><td>true</td></tr><tr><td>created_by</td><td>true</td></tr><tr><td>id</td><td>true</td></tr><tr><td>provisioner</td><td>true</td></tr><tr><td>group_acl</td><td>true</td></tr><tr><td>description</td><td>true</td></tr></tbody></table> |
| TemplateVersion | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>id</td><td>true</td></tr><tr><td>organization_id</td><td>false</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>created_by</td><td>true</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>name</td><td>true</td></tr><tr><td>readme</td><td>true</td></tr><tr><td>job_id</td><td>false</td></tr><tr><td>template_id</td><td>true</td></tr></tbody></table> |
| User | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>email</td><td>true</td></tr><tr><td>hashed_password</td><td>true</td></tr><tr><td>avatar_url</td><td>false</td></tr><tr><td>id</td><td>true</td></tr><tr><td>last_seen_at</td><td>false</td></tr><tr><td>deleted</td><td>true</td></tr><tr><td>username</td><td>true</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>login_type</td><td>false</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>status</td><td>true</td></tr><tr><td>rbac_roles</td><td>true</td></tr></tbody></table> |
| Workspace | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>updated_at</td><td>false</td></tr><tr><td>organization_id</td><td>false</td></tr><tr><td>deleted</td><td>false</td></tr><tr><td>ttl</td><td>true</td></tr><tr><td>last_used_at</td><td>false</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>autostart_schedule</td><td>true</td></tr><tr><td>name</td><td>true</td></tr><tr><td>id</td><td>true</td></tr><tr><td>owner_id</td><td>true</td></tr><tr><td>template_id</td><td>true</td></tr></tbody></table> |
| WorkspaceBuild | <table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody><tr><td>initiator_id</td><td>false</td></tr><tr><td>job_id</td><td>false</td></tr><tr><td>daily_cost</td><td>false</td></tr><tr><td>created_at</td><td>false</td></tr><tr><td>build_number</td><td>false</td></tr><tr><td>transition</td><td>false</td></tr><tr><td>deadline</td><td>false</td></tr><tr><td>reason</td><td>false</td></tr><tr><td>id</td><td>false</td></tr><tr><td>updated_at</td><td>false</td></tr><tr><td>provisioner_state</td><td>false</td></tr><tr><td>template_version_id</td><td>true</td></tr><tr><td>workspace_id</td><td>false</td></tr></tbody></table> |

<!-- End generated by 'make docs/admin/audit-logs.md'. -->

Expand Down
4 changes: 2 additions & 2 deletions scripts/auditdocgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func readAuditDoc() ([]byte, error) {
// Writes a markdown table of audit log resources to a buffer
func updateAuditDoc(doc []byte, auditableResourcesMap AuditableResourcesMap) ([]byte, error) {
// We must sort the resources to ensure table ordering
resourceNames := sortResources(auditableResourcesMap)
sortedResourceNames := sortResources(auditableResourcesMap)

i := bytes.Index(doc, generatorPrefix)
if i < 0 {
Expand All @@ -116,7 +116,7 @@ func updateAuditDoc(doc []byte, auditableResourcesMap AuditableResourcesMap) ([]
buffer.WriteString("|<b>Resource<b>||\n")
buffer.WriteString("|--|-----------------|\n")

for _, resourceName := range resourceNames {
for _, resourceName := range sortedResourceNames {
buffer.WriteString("|" + resourceName + "|<table><thead><tr><th>Field</th><th>Tracked</th></tr></thead><tbody>")

for fieldName, isTracked := range auditableResourcesMap[resourceName] {
Expand Down