-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[Domain Control] [Release 4] Add Restrict expense workspace creation/removal Toggle to DomainGroupDetailsPage
#88710
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
11 commits merged into
Expensify:main
from
software-mansion-labs:jakubstec/domains/security-group-details-page-group-permissions3
May 4, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7f03a84
feat: add Restrict expense workspace creation/removal toggle
jakubstec 68548ee
fix: change es.ts translation
jakubstec 1a3c894
Merge remote-tracking branch 'origin/war-in/domains/security-group-de…
jakubstec 67f3e9d
resolve merge conflict
jakubstec 55d54ff
fix: change guard to block when group itself is missing, add nullish …
jakubstec d7fa1d2
Merge remote-tracking branch 'origin/main' into jakubstec/domains/sec…
jakubstec d83c60c
Merge remote-tracking branch 'origin/main' into jakubstec/domains/sec…
jakubstec 433243e
Merge branch 'refs/heads/main' into jakubstec/domains/security-group-…
war-in 0a77f46
fix: prettier
war-in 8c52b1e
Merge branch 'jakubstec/domains/security-group-details-page-group-per…
jakubstec adac9a4
apply review changes
jakubstec 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
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
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
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
59 changes: 59 additions & 0 deletions
59
src/pages/domain/Groups/RestrictExpenseWorkspaceCreationToggle.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,59 @@ | ||
| import {domainSecurityGroupSettingErrorsSelector, domainSecurityGroupSettingPendingActionSelector, selectGroupByID} from '@selectors/Domain'; | ||
| import React from 'react'; | ||
| import {View} from 'react-native'; | ||
| import useLocalize from '@hooks/useLocalize'; | ||
| import useOnyx from '@hooks/useOnyx'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import ToggleSettingOptionRow from '@pages/workspace/workflows/ToggleSettingsOptionRow'; | ||
| import {clearDomainSecurityGroupSettingError, updateDomainSecurityGroup} from '@userActions/Domain'; | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
|
||
| type RestrictExpenseWorkspaceCreationToggleProps = { | ||
| /** The account ID of the domain */ | ||
| domainAccountID: number; | ||
|
|
||
| /** The ID of the security group */ | ||
| groupID: string; | ||
| }; | ||
|
|
||
| function RestrictExpenseWorkspaceCreationToggle({domainAccountID, groupID}: RestrictExpenseWorkspaceCreationToggleProps) { | ||
| const styles = useThemeStyles(); | ||
| const {translate} = useLocalize(); | ||
|
|
||
| const [group] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN}${domainAccountID}`, { | ||
| selector: selectGroupByID(groupID), | ||
| }); | ||
|
|
||
| const [enableRestrictedPolicyCreationPendingAction] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN_PENDING_ACTIONS}${domainAccountID}`, { | ||
| selector: domainSecurityGroupSettingPendingActionSelector('enableRestrictedPolicyCreation', groupID), | ||
| }); | ||
| const [enableRestrictedPolicyCreationErrors] = useOnyx(`${ONYXKEYS.COLLECTION.DOMAIN_ERRORS}${domainAccountID}`, { | ||
| selector: domainSecurityGroupSettingErrorsSelector('enableRestrictedPolicyCreationErrors', groupID), | ||
| }); | ||
|
|
||
| const isEnabled = !!group?.enableRestrictedPolicyCreation; | ||
|
|
||
| return ( | ||
| <View style={styles.mv3}> | ||
| <ToggleSettingOptionRow | ||
| title={translate('domain.groups.restrictExpenseWorkspaceCreation')} | ||
| subtitle={translate('domain.groups.restrictExpenseWorkspaceCreationDescription')} | ||
| switchAccessibilityLabel={translate('domain.groups.restrictExpenseWorkspaceCreation')} | ||
| shouldPlaceSubtitleBelowSwitch | ||
| isActive={isEnabled} | ||
| onToggle={(enabled) => { | ||
| if (!group) { | ||
| return; | ||
| } | ||
| updateDomainSecurityGroup(domainAccountID, groupID, group, {enableRestrictedPolicyCreation: enabled}, 'enableRestrictedPolicyCreation'); | ||
| }} | ||
| wrapperStyle={[styles.ph5]} | ||
| pendingAction={enableRestrictedPolicyCreationPendingAction} | ||
| errors={enableRestrictedPolicyCreationErrors} | ||
| onCloseError={() => clearDomainSecurityGroupSettingError(domainAccountID, groupID, 'enableRestrictedPolicyCreationErrors')} | ||
| /> | ||
| </View> | ||
| ); | ||
| } | ||
|
|
||
| export default RestrictExpenseWorkspaceCreationToggle; | ||
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
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.
docs