Skip to content

Conversation

@tmeasday
Copy link

Thoughts here:

  1. We only need one authorized loader (for the readOne case).
  2. We can determine the authQuery at initialization time, assuming that a single user will be used for all queries (this is the case).
  3. We can have the user at initialization time, although this will require refactoring the way the context is initialized here: https://github.com/tobkle/create-graphql-server/blob/master/skel/server/index.js

i. We need to add the models to the context after the authentication, i.e. here: https://github.com/tobkle/create-graphql-server/blob/master/skel/server/index.js#L44

ii. This will mean that we need a different reference to the mongo collection in the passport.authenticate call. But we can make that work I think, it doesn't really need the proper user collection.

  1. I don't think your promise constructor is required, promises already do that by default if I am reading it right.

Thoughts here:

1. We only need one authorized loader (for the `readOne` case).
2. We can determine the `authQuery` at initialization time, assuming that a single user will be used for all queries (this is the case).
3. We can have the user at initialization time, although this will require refactoring the way the context is initialized here: https://github.com/tobkle/create-graphql-server/blob/master/skel/server/index.js

  i. We need to add the models to the context *after* the authentication, i.e. here: https://github.com/tobkle/create-graphql-server/blob/master/skel/server/index.js#L44

 ii. This will mean that we need a different reference to the mongo collection in the `passport.authenticate` call. But we can make that work I think, it doesn't really need the proper user collection.
@tobkle tobkle merged commit 151b0b4 into tobkle:authorization Jul 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants