diff --git a/frontend/app/components/Session/Session.js b/frontend/app/components/Session/Session.js index af1cdb3d3..f43036f39 100644 --- a/frontend/app/components/Session/Session.js +++ b/frontend/app/components/Session/Session.js @@ -57,7 +57,7 @@ function Session({ ); } -export default withPermissions(['SESSION_REPLAY'])(connect((state, props) => { +export default withPermissions(['SESSION_REPLAY'], '', '/')(connect((state, props) => { const { match: { params: { sessionId } } } = props; return { sessionId, diff --git a/frontend/app/components/hocs/withPermissions.js b/frontend/app/components/hocs/withPermissions.js index 40597aa77..ee4b90fae 100644 --- a/frontend/app/components/hocs/withPermissions.js +++ b/frontend/app/components/hocs/withPermissions.js @@ -1,7 +1,7 @@ import { connect } from 'react-redux'; import { NoPermission } from 'UI'; -export default (requiredPermissions, className) => BaseComponent => +export default (requiredPermissions, className, backLink = '') => BaseComponent => @connect((state, props) => ({ permissions: state.getIn([ 'user', 'account', 'permissions' ]) || [], isEnterprise: state.getIn([ 'user', 'client', 'edition' ]) === 'ee', @@ -10,6 +10,6 @@ class extends React.PureComponent { render() { const hasPermission = this.props.permissions.some(permission => requiredPermissions.includes(permission)); - return !this.props.isEnterprise || hasPermission ? :
+ return !this.props.isEnterprise || hasPermission ? :
} } \ No newline at end of file diff --git a/frontend/app/components/ui/NoPermission/NoPermission.tsx b/frontend/app/components/ui/NoPermission/NoPermission.tsx index eaf43d4aa..f1cb37b86 100644 --- a/frontend/app/components/ui/NoPermission/NoPermission.tsx +++ b/frontend/app/components/ui/NoPermission/NoPermission.tsx @@ -1,13 +1,21 @@ import React from 'react'; import stl from './noPermission.css' -import { Icon } from 'UI'; +import { Icon, Button, Link } from 'UI'; -function NoPermission(props) { +interface Props { + backLink: string +} +function NoPermission({ backLink }: Props) { return (
Not allowed
You don’t have the necessary permissions to access this feature. Please check with your admin. + {backLink && ( + + + + )}
); }