nilan
08/11/2017, 8:28 AMantho1404
08/11/2017, 8:33 AMrob.s
08/11/2017, 9:00 AMreact-native run-ios
. The Red Box says "undefined is not an object (evaluating 'argv.indexOf')", which is coming from ${root}node_modules/supports-color/index.js:4:22
. Google search yesterday and today no help.rob.s
08/11/2017, 11:58 AMevan
08/11/2017, 1:49 PMevan
08/11/2017, 1:52 PMsteveb
08/11/2017, 3:48 PMsteveb
08/11/2017, 3:49 PMgojutin
08/11/2017, 4:10 PMcoffenbacher
08/11/2017, 8:13 PMmikedklein
08/11/2017, 8:41 PMDaniel K.
08/11/2017, 9:00 PMjohnny
08/11/2017, 10:37 PMquery ($user_id: ID!, $node_id: ID!) {
SomeUserExists(
filter: {
OR: [{
AND: [{
id: $user_id
},{
id: $node_id
}]
},{
id: $user_id,
roles_some: {
name: "admin"
}
}]
}
)
}
What I'm trying to achieve is, that only an admin or the user itself can read or update an entry in the User table.
It's working fine for a user with "admin"-role, but a normal user cannot access his own information anymore.quadsurf
08/11/2017, 10:59 PMDaniel K.
08/12/2017, 7:49 AMuserAccess
... it would probably require some function to compute that, but if I try to do this, I am getting error
The relation fieldthat doesn't make much sense to memust specify auserAccess
directive:@relation
@relation(name: "MyRelation")
type Game implements Node {
id: ID! @isUnique
createdAt: DateTime!
updatedAt: DateTime!
organizer: User! @relation(name: "GameOrganizer")
players: [Player!]! @relation(name: "PlayerGame")
applicants: [User!]! @relation(name: "UserApplication")
userAccess(userId: ID): UserGameAccess
}
enum UserGameAccess {
APPLICANT
PLAYER
ORG
}
Daniel K.
08/12/2017, 7:52 AMDaniel K.
08/12/2017, 10:54 AMDaniel K.
08/12/2017, 10:55 AMfreddie-codogo
08/12/2017, 11:18 AMjscript
08/12/2017, 11:28 AMGC_USER_ID
and GC_AUTH_TOKEN
anyone here knows where I can get those values?mattd
08/12/2017, 11:39 AMconstants.js
(note that āgraphcool-user-idā and āgraphcool-auth-tokenā are just strings and do not need to be replaced by anything):
export const GC_USER_ID = 'graphcool-user-id'
export const GC_AUTH_TOKEN = 'graphcool-auth-token'
Further down in the Routing section of the tutorial you should notice this block of code:
_saveUserData = (id, token) => {
localStorage.setItem(GC_USER_ID, id)
localStorage.setItem(GC_AUTH_TOKEN, token)
}
Here you are setting these values in localstorage with the id
and token
returned from your SigninUserMutation
.
This assumes you are following the React + Apollo tutorial, although other tutorials should be very similar.
Please let me know if you have any more questions!jscript
08/12/2017, 11:48 AM(note that "graphcool-user-id" and "graphcool-auth-token" are just strings and do not need to be replaced by anything):
! I was looking at Permanent Access Tokens, thank you.prabhjot85
08/12/2017, 12:48 PMprabhjot85
08/12/2017, 12:49 PMmarcusstenbeck
08/12/2017, 1:08 PMfreddie-codogo
08/12/2017, 1:39 PMmarcusstenbeck
08/12/2017, 1:53 PMpettanko
08/12/2017, 2:28 PMnikos
08/12/2017, 3:53 PMmax
08/12/2017, 7:46 PM