Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support resolver #2

Closed
dmitry opened this issue Aug 7, 2019 · 2 comments · Fixed by #3
Closed

Support resolver #2

dmitry opened this issue Aug 7, 2019 · 2 comments · Fixed by #3
Labels
enhancement New feature or request PR attached

Comments

@dmitry
Copy link

dmitry commented Aug 7, 2019

Use the shorter version of ActionPolicy::GraphQL::Behaviour to make it work:

module Types
  module Base
    class Resolver < ::GraphQL::Schema::Resolver
      include ActionPolicy::Behaviour
      include ActionPolicy::Behaviours::ThreadMemoized
      include ActionPolicy::Behaviours::Memoized
      include ActionPolicy::Behaviours::Namespaced

      authorize :user, through: :current_user

      def current_user
        context[:current_user]
      end
    end
  end
end

Would be great if it will be supported out of the box.

@palkan palkan added the enhancement New feature or request label Aug 7, 2019
palkan added a commit that referenced this issue Aug 7, 2019
@palkan
Copy link
Owner

palkan commented Aug 7, 2019

Thanks for the suggestion!

Please, take a look at #3. Is it something you're looking for?

@dmitry
Copy link
Author

dmitry commented Aug 8, 2019

@palkan thanks for the quick reply! #3 is perfectly fine!

@palkan palkan closed this as completed in #3 Aug 8, 2019
palkan added a commit that referenced this issue Aug 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PR attached
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants