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

Include extra args in AccessDenied exceptions #172

Closed
phallguy opened this issue Jan 27, 2015 · 4 comments
Closed

Include extra args in AccessDenied exceptions #172

phallguy opened this issue Jan 27, 2015 · 4 comments

Comments

@phallguy
Copy link
Contributor

We have certain permissions that are only enabled after the user has entered there password for a given session. This allows us to remember the user and show some limited info without them entering a password on each visit while also protecting the user's important information with their password.

To do this we catch the CanCan::AccessDenied exception and test if they would have been authorized had they entered their password. This works well for most authorization checks. It only fails if there are additional args int the authorize! block like so

authorize! :show, :named_feature, user_id: user.id

We can't recheck this demand because the AccessDenied exception does not include the user_id: user.id hash.

@blackst0ne
Copy link

I would like to this feature implemented in Cancancan.
Any plans on this?

@coorasse coorasse modified the milestone: 3.0 Jul 14, 2017
@coorasse
Copy link
Member

I'd be willing to accept a PR related to this issue

@kraflab
Copy link
Contributor

kraflab commented Feb 7, 2018

👋 I put up a PR for this, here: #482

@coorasse
Copy link
Member

will be release in 2.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants