{"action":"opened","issue":{"url":"https://api.github.com/repos/RStankov/SearchObjectGraphQL/issues/5","repository_url":"https://api.github.com/repos/RStankov/SearchObjectGraphQL","labels_url":"https://api.github.com/repos/RStankov/SearchObjectGraphQL/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/RStankov/SearchObjectGraphQL/issues/5/comments","events_url":"https://api.github.com/repos/RStankov/SearchObjectGraphQL/issues/5/events","html_url":"https://github.com/RStankov/SearchObjectGraphQL/issues/5","id":303280801,"number":5,"title":"Limiting scope to current_user","user":{"login":"gregology","id":1595448,"avatar_url":"https://avatars0.githubusercontent.com/u/1595448?v=4","gravatar_id":"","url":"https://api.github.com/users/gregology","html_url":"https://github.com/gregology","followers_url":"https://api.github.com/users/gregology/followers","following_url":"https://api.github.com/users/gregology/following{/other_user}","gists_url":"https://api.github.com/users/gregology/gists{/gist_id}","starred_url":"https://api.github.com/users/gregology/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gregology/subscriptions","organizations_url":"https://api.github.com/users/gregology/orgs","repos_url":"https://api.github.com/users/gregology/repos","events_url":"https://api.github.com/users/gregology/events{/privacy}","received_events_url":"https://api.github.com/users/gregology/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-07T22:17:39Z","updated_at":"2018-03-07T22:17:39Z","closed_at":null,"author_association":"NONE","body":"My graphql controller determines the current user and stores it in `ctx[:current_user]`. I use that to scope the returned records.\r\n\r\n```\r\n  field :Biometrics, !types[Types::BiometricType] do\r\n    resolve -> (obj, args, ctx) {\r\n      ctx[:current_user].biometrics\r\n    }\r\n  end\r\n```\r\n\r\nUsing SearchObject, what would be the equivalent way to limit the scope to the current_user? I was thinking something like this\r\n\r\n```\r\nclass Resolvers::BiometricsSearch\r\n  include SearchObject.module(:graphql)\r\n  binding.pry\r\n\r\n  scope { ctx[current_user].biometrics }\r\n  ...\r\n```\r\n\r\nBut context isn't available in the Resolver\r\n\r\nThanks Team!"}}
{"actor":{"display_login":"gregology"}}