Skip to content

Commit be7b6a0

Browse files
fix: added owner check for WS pages
1 parent 8923cb0 commit be7b6a0

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

src/pages/ReimbursementAccount/ReimbursementAccountPage.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import * as ReimbursementAccountProps from './reimbursementAccountPropTypes';
3232
import reimbursementAccountDraftPropTypes from './ReimbursementAccountDraftPropTypes';
3333
import withPolicy from '../workspace/withPolicy';
3434
import FullPageNotFoundView from '../../components/BlockingViews/FullPageNotFoundView';
35+
import * as Policy from '../../libs/actions/Policy';
3536

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

333-
if (_.isEmpty(this.props.policy)) {
334+
if (_.isEmpty(this.props.policy) || !Policy.isPolicyOwner(this.props.policy)) {
334335
return (
335336
<ScreenWrapper>
336337
<FullPageNotFoundView
337338
shouldShow
338339
onBackButtonPress={() => Navigation.navigate(ROUTES.SETTINGS_WORKSPACES)}
340+
subtitleKey={_.isEmpty(this.props.policy) ? undefined : 'workspace.common.notAuthorized'}
339341
shouldShowLink
340342
/>
341343
</ScreenWrapper>

src/pages/workspace/WorkspaceInviteMessagePage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ class WorkspaceInviteMessagePage extends React.Component {
158158
return (
159159
<ScreenWrapper includeSafeAreaPaddingBottom={false}>
160160
<FullPageNotFoundView
161-
shouldShow={_.isEmpty(this.props.policy)}
161+
shouldShow={_.isEmpty(this.props.policy) || !Policy.isPolicyOwner(this.props.policy)}
162+
subtitleKey={_.isEmpty(this.props.policy) ? undefined : 'workspace.common.notAuthorized'}
162163
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
163164
>
164165
<HeaderWithBackButton

src/pages/workspace/WorkspaceInvitePage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ class WorkspaceInvitePage extends React.Component {
272272
const sections = didScreenTransitionEnd ? this.getSections() : [];
273273
return (
274274
<FullPageNotFoundView
275-
shouldShow={_.isEmpty(this.props.policy)}
275+
shouldShow={_.isEmpty(this.props.policy) || !Policy.isPolicyOwner(this.props.policy)}
276+
subtitleKey={_.isEmpty(this.props.policy) ? undefined : 'workspace.common.notAuthorized'}
276277
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
277278
>
278279
<HeaderWithBackButton

src/pages/workspace/WorkspaceMembersPage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ function WorkspaceMembersPage(props) {
404404
>
405405
{({safeAreaPaddingBottomStyle}) => (
406406
<FullPageNotFoundView
407-
shouldShow={_.isEmpty(props.policy)}
407+
shouldShow={_.isEmpty(props.policy) || !Policy.isPolicyOwner(props.policy)}
408+
subtitleKey={_.isEmpty(props.policy) ? undefined : 'workspace.common.notAuthorized'}
408409
onBackButtonPress={() => Navigation.goBack(ROUTES.SETTINGS_WORKSPACES)}
409410
>
410411
<HeaderWithBackButton

0 commit comments

Comments
 (0)