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

Make authorize a module method #226

Closed
scottjacobsen opened this issue Nov 5, 2014 · 4 comments
Closed

Make authorize a module method #226

scottjacobsen opened this issue Nov 5, 2014 · 4 comments

Comments

@scottjacobsen
Copy link

I've run into cases where it would be nice to use the authorize method outside a controller. It would be handy to be able to do Pundit.authorize(user, record, :edit?) where that method would raise Pundit::NotAuthorizedError if the action is not authorized.

It seems like it would be a simple matter of making the current authorize method a module method that takes three arguments - user, record, query, and making the current authorize instance method delegate to that method.

I would be happy to submit a PR if that sounds like it is worth doing.

@thomasklemm
Copy link
Collaborator

Sounds like an interesting idea to me, so a PR would be great!

@openface
Copy link

Any progress on getting this feature implemented?

@scottjacobsen
Copy link
Author

As far as I know my PR is ready to go.

@scottjacobsen
Copy link
Author

Closed by 56a8bde

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 a pull request may close this issue.

3 participants