- Notifications
You must be signed in to change notification settings - Fork1k
feat: generate RBAC scope name constants#19896
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
ThomasK33 merged 1 commit intomainfromthomask33/09-19-feat_add_scope_constants_generationSep 24, 2025
Merged
feat: generate RBAC scope name constants#19896
ThomasK33 merged 1 commit intomainfromthomask33/09-19-feat_add_scope_constants_generationSep 24, 2025
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This was referencedSep 19, 2025
MemberAuthor
ThomasK33 commentedSep 19, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
efb80b5
to0dadef5
Compare1d5d9f1
toce47b02
Compare0149b55
to6de9975
Comparece47b02
to37f92fe
Compare This was referencedSep 22, 2025
6de9975
to99afbd9
Compare9c60b1f
to2666417
Compare6a22bcc
to2dc79e0
Compare3a1adbe
to9d2bcc2
Compare2dc79e0
to92537e5
Compare9d2bcc2
toec7f46a
Compare4810c5e
to6d04e1c
Compareec7f46a
to0fb96eb
Compare6d04e1c
to49feb2d
Compare0fb96eb
to0d6db42
Compare0d6db42
toe0432eb
Compare49feb2d
toa9ec515
Comparee0432eb
tob4b6ef1
Comparea9ec515
to316bcd9
Compareb4b6ef1
tocfd4f7f
Compare316bcd9
to2dd3612
Compare This was referencedSep 24, 2025
Emyrk approved these changesSep 24, 2025
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
cfd4f7f
toacc0890
Compare2dd3612
toeddb2a7
Compareab8574e
tocffaa05
CompareAdd build-time generation of typed Go constants for all RBAC scopenames to improve type safety and prevent typos when referencingscopes in code.- Add scopenames.gotmpl template for generating ScopeName constants- Extend scripts/typegen/main.go to support "scopenames" template- Generate coderd/rbac/scopes_constants_gen.go with all typed constants- Update Makefile to include generated file in build targets- Constants follow pattern Scope<Resource><Action> = "resource:action"
cffaa05
to84de60e
Compareadb7521
intomain 32 checks passed
Uh oh!
There was an error while loading.Please reload this page.
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generate RBAC scope name constants
This PR adds a new generated file
coderd/rbac/scopes_constants_gen.go
that contains typed constants for all RBAC scope names in the formatScope<Resource><Action>
. For example,ScopeWorkspaceRead
for the scope "workspace:read".These constants make it easier to reference specific scopes in code without using string literals, improving type safety and making refactoring easier.
The PR:
scripts/typegen/scopenames.gotmpl