From a24eb1cfbd3c294bea39bca53125883c270ca91f Mon Sep 17 00:00:00 2001 From: Wes Bos Date: Fri, 6 Apr 2018 09:55:40 -0400 Subject: revert back to @connection --- frontend/components/PleaseSignIn.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'frontend/components/PleaseSignIn.js') diff --git a/frontend/components/PleaseSignIn.js b/frontend/components/PleaseSignIn.js index bd96842..1533dbd 100644 --- a/frontend/components/PleaseSignIn.js +++ b/frontend/components/PleaseSignIn.js @@ -1,19 +1,31 @@ import { Query } from 'react-apollo'; import { CURRENT_USER_QUERY } from '../queries/index'; import Signin from './Signin'; +import Dump from './Dump'; const PleaseSignIn = props => ( {({ data }) => { - if (data.me) { - return props.children; + // check if they are signed in + if (!data.me) { + return ( +
+

Please sign in before continuing!

+ +
+ ); } - return ( -
-

Please sign in before continuing!

- -
- ); + // check if they need permissions + if (props.allowedPermissions) { + // check if they NO permissions, or they don't meet the requmrenets + if ( + !data.me.permissions || + !props.allowedPermissions.some(permission => data.me.permissions.contains(permission)) + ) { + return

Insufficient Permissions to Manage Permissions

; + } + } + return props.children; }}
); -- cgit v1.3