-
Notifications
You must be signed in to change notification settings - Fork 513
feat: Add permission_ids support to team member profiles and invitations #870
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
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
cf8e76b
feat: Add permission_ids support to team member profiles and invitations
bootssecurity 1701d2d
Fix member list roles by adding permission_ids to team-member-profile…
bootssecurity 6940ffe
Update StackClientInterface to return JSON response from API call
bootssecurity 631b831
Merge upstream/dev into dev - sync with main repository
bootssecurity 3bdf720
Merge branch 'dev' into dev
bootssecurity 866cfaf
Enhance team invitation and member profile tests to include permissio…
2af2c86
Update apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts
bootssecurity a27b1f4
Update apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts
bootssecurity e63c0cc
Add edge case and permission escalation tests for team invitations
729f46e
Refine permission handling in team member invitation section
7d71fc3
Update apps/e2e/tests/backend/endpoints/api/v1/team-invitations.test.ts
bootssecurity 35b8460
Refactor team invitation tests to improve error response validation
a40c521
Merge branch 'dev' of https://github.com/bootssecurity/stack-auth int…
708fe14
Merge branch 'stack-auth:dev' into dev
bootssecurity File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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 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
46 changes: 46 additions & 0 deletions
46
apps/backend/src/app/api/latest/team-invitations/role-permissions/route.tsx
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import { listPermissionDefinitions } from "@/lib/permissions"; | ||
| import { createSmartRouteHandler } from "@/route-handlers/smart-route-handler"; | ||
| import { adaptSchema, clientOrHigherAuthTypeSchema, yupArray, yupBoolean, yupNumber, yupObject, yupString } from "@stackframe/stack-shared/dist/schema-fields"; | ||
|
|
||
| export const GET = createSmartRouteHandler({ | ||
| metadata: { | ||
| summary: "Get role-based permissions for team invitations", | ||
| description: "Fetch available role-based permissions that can be assigned to team members during invitations. Only returns role-based permissions, not system permissions.", | ||
|
bootssecurity marked this conversation as resolved.
|
||
| tags: ["Teams"], | ||
| }, | ||
|
bootssecurity marked this conversation as resolved.
|
||
| request: yupObject({ | ||
| auth: yupObject({ | ||
| type: clientOrHigherAuthTypeSchema, | ||
| tenancy: adaptSchema.defined(), | ||
| user: adaptSchema.optional(), | ||
| }).defined(), | ||
| }), | ||
| response: yupObject({ | ||
| statusCode: yupNumber().oneOf([200]).defined(), | ||
| bodyType: yupString().oneOf(["json"]).defined(), | ||
| body: yupObject({ | ||
| items: yupArray(yupObject({ | ||
| id: yupString().defined(), | ||
| description: yupString().optional(), | ||
| contained_permission_ids: yupArray(yupString().defined()).defined(), | ||
| }).defined()).defined(), | ||
| is_paginated: yupBoolean().oneOf([false]).defined(), | ||
| }).defined(), | ||
| }), | ||
| async handler({ auth }) { | ||
| const allPermissions = await listPermissionDefinitions({ | ||
| scope: "team", | ||
| tenancy: auth.tenancy, | ||
| }); | ||
|
|
||
| // Return all permissions including system permissions (starting with $) | ||
| return { | ||
| statusCode: 200, | ||
| bodyType: "json", | ||
| body: { | ||
| items: allPermissions, | ||
| is_paginated: false, | ||
| }, | ||
| }; | ||
| }, | ||
| }); | ||
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 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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.