do not show admin drawer unless user has access

Fixes https://github.com/coralproject/talk/issues/1791
This commit is contained in:
Bryce Kahle
2018-10-08 13:02:37 -04:00
parent d0eca26d5b
commit 8b2dc3a46d
3 changed files with 15 additions and 7 deletions
+5 -6
View File
@@ -7,9 +7,9 @@ import t from 'coral-framework/services/i18n';
import { can } from 'coral-framework/services/perms';
import cn from 'classnames';
const CoralDrawer = ({ handleLogout, currentUser }) => (
<Drawer className={cn('talk-admin-drawer-nav', styles.drawer)}>
{currentUser && can(currentUser, 'ACCESS_ADMIN') ? (
const CoralDrawer = ({ handleLogout, currentUser }) =>
currentUser && can(currentUser, 'ACCESS_ADMIN') ? (
<Drawer className={cn('talk-admin-drawer-nav', styles.drawer)}>
<div>
<Navigation className={styles.nav}>
{can(currentUser, 'MODERATE_COMMENTS') && (
@@ -48,9 +48,8 @@ const CoralDrawer = ({ handleLogout, currentUser }) => (
<span>{`v${process.env.VERSION}`}</span>
</Navigation>
</div>
) : null}
</Drawer>
);
</Drawer>
) : null;
CoralDrawer.propTypes = {
handleLogout: PropTypes.func.isRequired,