-
Notifications
You must be signed in to change notification settings - Fork 12k
refactor: replace isTeamAdminOrOwner with PBAC team.listMembers permission #24006
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
982f2e4
refactor: replace isTeamAdminOrOwner with PBAC team.listMembers permi…
devin-ai-integration[bot] 4195c95
refactor: wrap canListMembers in permissions object and simplify serv…
devin-ai-integration[bot] 257977c
docs: add comment explaining canListMembers UI logic
devin-ai-integration[bot] d87697e
feat: add e2e test for member filter visibility
devin-ai-integration[bot] b5220a1
fix: correct e2e test team member creation pattern
devin-ai-integration[bot] f2b9718
fix e2e test
eunjae-lee 64694e4
remove booking.read permission from member
eunjae-lee 14d44f7
add guide
eunjae-lee 005bb99
update
eunjae-lee 25eb7b2
resource scope
eunjae-lee dfbfe98
Merge branch 'main' into devin/pbac-refactor-bookings-1758631859
eunjae-lee 47985e8
fix markdown
eunjae-lee 823ae41
Merge branch 'main' into devin/pbac-refactor-bookings-1758631859
eunjae-lee a74e259
update usage
eunjae-lee f78b83d
update guide
eunjae-lee 475bd68
Merge branch 'main' into devin/pbac-refactor-bookings-1758631859
sean-brydon da11d43
Merge branch 'main' into devin/pbac-refactor-bookings-1758631859
eunjae-lee 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
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,51 @@ | ||
| import { expect } from "@playwright/test"; | ||
|
|
||
| import { test } from "./lib/fixtures"; | ||
|
|
||
| test.describe.configure({ mode: "parallel" }); | ||
|
|
||
| test.afterEach(({ users }) => users.deleteAll()); | ||
|
|
||
eunjae-lee marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| test.describe("Booking Filters", () => { | ||
| test("Member role should not see the member filter", async ({ page, users }) => { | ||
| const teamMateName = "team mate 1"; | ||
| await users.create(undefined, { | ||
| hasTeam: true, | ||
| isOrg: true, | ||
| teammates: [{ name: teamMateName }], | ||
| }); | ||
|
|
||
| const allUsers = await users.get(); | ||
| const memberUser = allUsers.find((user) => user.name === teamMateName); | ||
|
|
||
| // eslint-disable-next-line playwright/no-conditional-in-test | ||
| if (!memberUser) { | ||
| throw new Error("user should exist"); | ||
| } | ||
|
|
||
| await memberUser.apiLogin(); | ||
| const bookingsGetResponse = page.waitForResponse((response) => | ||
| /\/api\/trpc\/bookings\/get.*/.test(response.url()) | ||
| ); | ||
| await page.goto(`/bookings/upcoming`, { waitUntil: "domcontentloaded" }); | ||
| await bookingsGetResponse; | ||
| await page.locator('[data-testid="add-filter-button"]').click(); | ||
| await expect(page.locator('[data-testid="add-filter-item-userId"]')).toBeHidden(); | ||
| }); | ||
|
|
||
| test("Admin role should see the member filter", async ({ page, users }) => { | ||
| const owner = await users.create(undefined, { | ||
| hasTeam: true, | ||
| isOrg: true, | ||
| }); | ||
|
|
||
| await owner.apiLogin(); | ||
| const bookingsGetResponse = page.waitForResponse((response) => | ||
| /\/api\/trpc\/bookings\/get.*/.test(response.url()) | ||
| ); | ||
| await page.goto(`/bookings/upcoming`, { waitUntil: "domcontentloaded" }); | ||
| await bookingsGetResponse; | ||
| await page.locator('[data-testid="add-filter-button"]').click(); | ||
| await expect(page.locator('[data-testid="add-filter-item-userId"]')).toBeVisible(); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
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.
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.
We need to keep in mind fallback roles here - getTeamIdsWithpermissions doesnt account for that
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.
Ah !
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.
for the future reference: getTeamIdsWithpermissions now supports fallbackRoles since #24042