Files
coder/scripts/rbacgen/typescript.tstmpl
Steven Masley ecc356f5a9 chore: generate rbac resource types to typescript (#13975)
* chore: generate rbac resource types to typescript

The existing typesGenerated.ts cannot support this as the generator
only inspects the types, not the values. So traversing the value AST
would have to be added. The rbac gen is already used for the sdk,
this extends it to the typescript
2024-07-23 10:07:52 -05:00

20 lines
685 B
Plaintext

// Code generated by rbacgen/main.go. DO NOT EDIT.
import type { RBACAction, RBACResource } from "./typesGenerated";
// RBACResourceActions maps RBAC resources to their possible actions.
// Descriptions are included to document the purpose of each action.
// Source is in 'coderd/rbac/policy/policy.go'.
export const RBACResourceActions: Partial<
Record<RBACResource, Partial<Record<RBACAction, string>>>
> = {
{{- range $element := . }}
{{- if eq $element.Type "*" }}{{ continue }}{{ end }}
{{ $element.Type }}: {
{{- range $actionValue, $actionDescription := $element.Actions }}
{{ $actionValue }}: "{{ $actionDescription }}",
{{- end }}
},
{{- end }}
};