Implement read-only access to workspace pages#91305
Conversation
|
Hey, I noticed you changed If you want to automatically generate translations for other locales, an Expensify employee will have to:
Alternatively, if you are an external contributor, you can run the translation script locally with your own OpenAI API key. To learn more, try running: npx ts-node ./scripts/generateTranslations.ts --helpTypically, you'd want to translate only what you changed by running |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bddbc9abf
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
JmillsExpensify
left a comment
There was a problem hiding this comment.
This looks really solid to me!
|
Added Design to the PR so that we can get their take as well. |
|
Looks solid so far. I do think we need to make a final decision on our approach here though. Are we leaning towards always showing buttons, but making them disabled and then using the centered alert modal? |
|
Yeah, that's true that where we land for the HR integrations could change this one too. I tend to think that we do that separately and not block this PR on that consideration. |
|
Yeah I'm down to not block this PR and follow up if needed. This is looking good so far! I think I caught a few examples in the video above: any non-editable push rows should not have any hover states. Also, for some of these table items, I think the Auditor will need to be able to click on them to see the (read-only) details RHP, right? |
Pujan92
left a comment
There was a problem hiding this comment.
Some initial review comments
| } | ||
|
|
||
| // We check isPendingDelete and prevIsPendingDelete to prevent the NotFound view from showing right after we delete the workspace | ||
| const canShowPage = hasAccessToPolicyFeature ?? (canEditWorkspaceSettings(policy, currentUserLogin) || shouldShowNonAdmin); |
There was a problem hiding this comment.
| const canShowPage = hasAccessToPolicyFeature; |
We can also get rid of the prop shouldShowNonAdmin, maybe in future pr if not now
There was a problem hiding this comment.
Yes this can be cleaned up later. Fallback is still needed while policyFeature is optional.
| const accessVariantsToCheck = policyFeature ? accessVariants.filter((variant) => variant !== CONST.POLICY.ACCESS_VARIANTS.ADMIN) : accessVariants; | ||
| const isPageAccessible = accessVariantsToCheck.reduce((acc, variant) => { |
There was a problem hiding this comment.
wondering why do we need this change
There was a problem hiding this comment.
When policyFeature is provided, admin-only access variants must be skipped, otherwise non-admin roles with read access would still not have access. What do you think?
There was a problem hiding this comment.
Yes, makes sense. Also AccessOrNotFoundWrapper component is used across the app and not only for workspace pages, just adding policy feature prop compulsarily to all workspace pages won't solve the issue for non-workspace pages.
@dannymcclain I think so. Thoughts @flodnv? |
Is that not happening on staging ? |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
No, but for auditor role it seems the value of nvp_expensify_ccCustomNames is missing. BE change might be needed. cc: @flodnv |
| shouldShowRightIcon={canWriteCompanyCards} | ||
| brickRoadIndicator={card?.nameValuePairs?.errorFields?.cardTitle ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} | ||
| onPress={() => Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARD_EDIT_CARD_NAME.getRoute(policyID, cardID, feedName))} | ||
| onPress={canWriteCompanyCards ? () => Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARD_EDIT_CARD_NAME.getRoute(policyID, cardID, feedName)) : undefined} |
There was a problem hiding this comment.
| onPress={canWriteCompanyCards ? () => Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARD_EDIT_CARD_NAME.getRoute(policyID, cardID, feedName)) : undefined} | |
| onPress={() => Navigation.navigate(ROUTES.WORKSPACE_COMPANY_CARD_EDIT_CARD_NAME.getRoute(policyID, cardID, feedName))} | |
| interactive={canWriteCompanyCards} |
For all MenuItem we can apply these changes to avoid showing the below hover effect
Screen.Recording.2026-05-27.at.18.22.01.mov
|
@ShridharGoel conflicts to resolve |
|
@Pujan92 Can you check now? |
| function WorkspaceCompanyCardsPage({route}: WorkspaceCompanyCardsPageProps) { | ||
| const policyID = route.params.policyID; | ||
| const {translate} = useLocalize(); | ||
| const {email: currentUserEmail = ''} = useCurrentUserPersonalDetails(); |
There was a problem hiding this comment.
any specific reason to use email instead of login here? As I see some places login is used and for others email
|
|

Explanation of Change
This adds the frontend support for workspace scoped roles.
Auditors can now open workspace pages they have read access to, including direct links. The workspace menu checks feature read permissions before showing each item. Page access wrappers use the new policy feature read check instead of requiring full admin access when a page passes
policyFeature.This also allows read-only access by disabling or hiding write-only controls on the More Features, Expensify Card, and Company Cards top-level pages.
Fixed Issues
$ #90497, #90498
PROPOSAL:
Tests
Offline tests
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
Screen.Recording.2026-05-22.at.1.28.50.AM.mov