Skip to content

fix: give admin roles to admin #35

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions src/owner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ export const baseMockUser: WorkspaceOwner = {
],
};

export type User = "admin" | "developer" | "contractor" | "eu-developer" | "sales";
export type User =
| "admin"
| "developer"
| "contractor"
| "eu-developer"
| "sales";

export const mockUsers: Record<User, WorkspaceOwner> = {
admin: {
Expand All @@ -26,6 +31,17 @@ export const mockUsers: Record<User, WorkspaceOwner> = {
full_name: "Admin",
email: "[email protected]",
groups: ["admin"],
rbac_roles: [
...baseMockUser.rbac_roles,
{
name: "owner",
org_id: "",
},
{
name: "organization-admin",
org_id: "09942665-ba1b-4661-be9f-36bf9f738c83",
},
],
Comment on lines +34 to +44
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know enough of our RBAC system to know what this code is doing for certain. Do you know of any documentation pages that'd be relevant here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not super knowledgeable on the roles either, but it's the role I was told to add in the linked issue. I found the roles here in coder/coder.

Some more docs around the different roles here

Copy link
Member

@Parkreiner Parkreiner Jul 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also tried going through the files in the repo, and didn't see anything that actually processes these roles. Are these properties being added for completion's/accuracy's sake, or is this change actually changing behavior?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switching between these users can change how the forms render (assuming that you have logic within the terraform that depends on the different roles, groups, etc.).

There is no change in behavior directly, but the idea is that an admin user would have these roles so it makes more sense for examples. A PR I'm currently working on is to also add custom users which makes this less important but still better to have more common sense default values.

},
developer: {
...baseMockUser,
Expand All @@ -48,7 +64,7 @@ export const mockUsers: Record<User, WorkspaceOwner> = {
email: "[email protected]",
groups: ["developer", "eu-helsinki"],
},
"sales": {
sales: {
...baseMockUser,
name: "sales",
full_name: "Sales",
Expand Down