From be7b6a09cde880cd96470e4e9e0c2f921499dd20 Mon Sep 17 00:00:00 2001 From: BhuvaneshPatil Date: Wed, 12 Jul 2023 23:19:12 +0530 Subject: [PATCH] fix: added owner check for WS pages --- src/pages/ReimbursementAccount/ReimbursementAccountPage.js | 4 +++- src/pages/workspace/WorkspaceInviteMessagePage.js | 3 ++- src/pages/workspace/WorkspaceInvitePage.js | 3 ++- src/pages/workspace/WorkspaceMembersPage.js | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js index 345968189536..007457b21ee2 100644 --- a/src/pages/ReimbursementAccount/ReimbursementAccountPage.js +++ b/src/pages/ReimbursementAccount/ReimbursementAccountPage.js @@ -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 */ @@ -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 ( Navigation.navigate(ROUTES.SETTINGS_WORKSPACES)} + subtitleKey={_.isEmpty(this.props.policy) ? undefined : 'workspace.common.notAuthorized'} shouldShowLink /> diff --git a/src/pages/workspace/WorkspaceInviteMessagePage.js b/src/pages/workspace/WorkspaceInviteMessagePage.js index 8e89dea89523..e51892468a9e 100644 --- a/src/pages/workspace/WorkspaceInviteMessagePage.js +++ b/src/pages/workspace/WorkspaceInviteMessagePage.js @@ -158,7 +158,8 @@ class WorkspaceInviteMessagePage extends React.Component { return ( Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)} > Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)} > {({safeAreaPaddingBottomStyle}) => ( Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)} >