-
Notifications
You must be signed in to change notification settings - Fork 44
feat: Add organization role support #1455
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
base: feature/ent-4798-workos-node-environment-roles
Are you sure you want to change the base?
feat: Add organization role support #1455
Conversation
Greptile OverviewGreptile SummaryAdded organization role support to the Authorization module, mirroring the existing environment role functionality with organization-scoped operations.
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Client
participant Authorization
participant WorkOS API
participant Serializer
Note over Client,Serializer: Create Organization Role Flow
Client->>Authorization: createOrganizationRole(orgId, options)
Authorization->>Serializer: serializeCreateOrganizationRoleOptions(options)
Serializer-->>Authorization: serialized options
Authorization->>WorkOS API: POST /authorization/organizations/{orgId}/roles
WorkOS API-->>Authorization: OrganizationRoleResponse
Authorization->>Serializer: deserializeOrganizationRole(data)
Serializer-->>Authorization: OrganizationRole
Authorization-->>Client: OrganizationRole
Note over Client,Serializer: List Organization Roles Flow
Client->>Authorization: listOrganizationRoles(orgId, options?)
Authorization->>WorkOS API: GET /authorization/organizations/{orgId}/roles
WorkOS API-->>Authorization: ListOrganizationRolesResponse
Authorization->>Serializer: deserializeRole() for each role
Serializer-->>Authorization: Role[]
Authorization-->>Client: RoleList (EnvironmentRole + OrganizationRole)
Note over Client,Serializer: Permission Management Flow
Client->>Authorization: addOrganizationRolePermission(orgId, slug, permSlug)
Authorization->>WorkOS API: POST /authorization/organizations/{orgId}/roles/{slug}/permissions
WorkOS API-->>Authorization: OrganizationRoleResponse
Authorization->>Serializer: deserializeOrganizationRole(data)
Serializer-->>Authorization: OrganizationRole with updated permissions
Authorization-->>Client: OrganizationRole
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 files reviewed, no comments
| export interface OrganizationRole { | ||
| object: 'role'; | ||
| id: string; | ||
| name: string; | ||
| slug: string; | ||
| description: string | null; | ||
| permissions: string[]; | ||
| type: 'OrganizationRole'; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update the Role type to be a union of this and the EnvironmentRole type?
| organizationId: string, | ||
| slug: string, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth disambiguating all of these orgId/slug parameters with an object. Similar comment from other PR, so good with matching whatever decision you make there.
Description
Documentation
Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.
If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.