-
Notifications
You must be signed in to change notification settings - Fork 66
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
Create Example of Using CanCan for Authorization to Upmin #144
Comments
I will try to get a quick guide setup for this tomorrow. Didn't get a chance to do it today. |
I am not blocked by any means so please don't feel you need to react immediately. I will monitor this issue. Thanks. |
Would it make more sense to target CanCanCan specifically since CanCan is no longer maintained? |
That makes sense. I was looking for a popular authz framework and CanCan came up. I do suspect the configuration for CanCan and CanCanCan will be very similar if not identical. |
Yeah, it should be 90+% the same for now. It might be good to drive people to CanCanCan though, as I suspect the now defunct CanCan may have issues with upcoming Rails versions. Do you need help with the docs on this? |
I can look into both, but agree the main focus should probably be on CanCanCan. I'll probably just put little side notes for what is different in CanCan. @SingleShot if you are just looking for a good auth framework, Devise is pretty solid and really simple to use with mountable engines (which Upmin is). |
@Ch4s3 I have never used CanCanCan, so if you want to write up the docs fast it would help. My assumption is that either:
|
Yeah, you would need to pull down the controller and add and authorization method, and set up a permissions file. I can write up something in the next couple of days. I use upmin, but have never run it from source, so I'll have to do that first. I may also roll a quick test app to make sure it works too. |
@Ch4s3 You don't need to run it from source. If you copy the controller I linked you and just add it inside of your rails app under that folder the engine will use your file over its local copy. All engines work this way (as far as I can tell) making it super easy to override things. |
@joncalhoun - thanks for the Devise recommendation. I am using that for authentication, but I want to use CanCan(Can) for authorization. |
@SingleShot Can you check out the following files to tell me if they roughly do what you are looking for? I just want to make sure we are on the same page before writing up docs. Restricting upmin to just admins via cancan: https://github.com/upmin/store_demo/blob/cancancan_devise/app/controllers/upmin/application_controller.rb Only show admin link to admins via cancan: https://github.com/upmin/store_demo/blob/cancancan_devise/app/views/static/index.html.haml#L5 demo ability model to make this work: https://github.com/upmin/store_demo/blob/cancancan_devise/app/models/ability.rb |
It is unclear to me how I would use CanCan to authorize access to Upmin. I tried a few things but was unable to figure it out. It would be nice if there were an example of doing this. Thanks.
The text was updated successfully, but these errors were encountered: