change(ui) - permissions go back for sessions
This commit is contained in:
parent
e1f435e858
commit
cd22e242fc
3 changed files with 13 additions and 5 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 ? <BaseComponent {...this.props} /> : <div className={className}><NoPermission /></div>
|
||||
return !this.props.isEnterprise || hasPermission ? <BaseComponent {...this.props} /> : <div className={className}><NoPermission backLink={backLink} /></div>
|
||||
}
|
||||
}
|
||||
|
|
@ -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 (
|
||||
<div className={stl.wrapper}>
|
||||
<Icon name="shield-lock" size="50" className="py-16"/>
|
||||
<div className={ stl.title }>Not allowed</div>
|
||||
You don’t have the necessary permissions to access this feature. Please check with your admin.
|
||||
{backLink && (
|
||||
<Link to={backLink}>
|
||||
<Button primary className="mt-6">GO BACK</Button>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue