Skip to content

Commit

Permalink
Merge pull request #22761 from BhuvaneshPatil/21998-member-invite-WS-…
Browse files Browse the repository at this point in the history
…lock

fix: added owner check for WS pages
  • Loading branch information
AndrewGable authored Jul 17, 2023
2 parents 798016a + be7b6a0 commit 7770b86
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/pages/ReimbursementAccount/ReimbursementAccountPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import * as ReimbursementAccountProps from './reimbursementAccountPropTypes';
import reimbursementAccountDraftPropTypes from './ReimbursementAccountDraftPropTypes';
import withPolicy from '../workspace/withPolicy';
import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView';
import * as Policy from '../../libs/actions/Policy';

const propTypes = {
/** Plaid SDK token to use to initialize the widget */
Expand Down Expand Up @@ -330,12 +331,13 @@ class ReimbursementAccountPage extends React.Component {
const currentStep = achData.currentStep || CONST.BANK_ACCOUNT.STEP.BANK_ACCOUNT;
const policyName = lodashGet(this.props.policy, 'name');

if (_.isEmpty(this.props.policy)) {
if (_.isEmpty(this.props.policy) || !Policy.isPolicyOwner(this.props.policy)) {
return (
<ScreenWrapper>
<FullPageNotFoundView
shouldShow
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_WORKSPACES)}
subtitleKey={_.isEmpty(this.props.policy) ? undefined : 'workspace.common.notAuthorized'}
shouldShowLink
/>
</ScreenWrapper>
Expand Down
3 changes: 2 additions & 1 deletion src/pages/workspace/WorkspaceInviteMessagePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ class WorkspaceInviteMessagePage extends React.Component {
return (
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
<FullPageNotFoundView
shouldShow={_.isEmpty(this.props.policy)}
shouldShow={_.isEmpty(this.props.policy) || !Policy.isPolicyOwner(this.props.policy)}
subtitleKey={_.isEmpty(this.props.policy) ? undefined : 'workspace.common.notAuthorized'}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
>
<HeaderWithBackButton
Expand Down
3 changes: 2 additions & 1 deletion src/pages/workspace/WorkspaceInvitePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ class WorkspaceInvitePage extends React.Component {
const sections = didScreenTransitionEnd ? this.getSections() : [];
return (
<FullPageNotFoundView
shouldShow={_.isEmpty(this.props.policy)}
shouldShow={_.isEmpty(this.props.policy) || !Policy.isPolicyOwner(this.props.policy)}
subtitleKey={_.isEmpty(this.props.policy) ? undefined : 'workspace.common.notAuthorized'}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
>
<HeaderWithBackButton
Expand Down
3 changes: 2 additions & 1 deletion src/pages/workspace/WorkspaceMembersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,8 @@ function WorkspaceMembersPage(props) {
>
{({safeAreaPaddingBottomStyle}) => (
<FullPageNotFoundView
shouldShow={_.isEmpty(props.policy)}
shouldShow={_.isEmpty(props.policy) || !Policy.isPolicyOwner(props.policy)}
subtitleKey={_.isEmpty(props.policy) ? undefined : 'workspace.common.notAuthorized'}
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
>
<HeaderWithBackButton
Expand Down

0 comments on commit 7770b86

Please sign in to comment.