codemancers / rapidfire

Making dynamic surveys should be easy!
https://rapidfire.fly.dev/
MIT License
319 stars 141 forks source link

Removed before_filter from controllers for giving users more control #121

Closed akshaysasidrn closed 4 years ago

akshaysasidrn commented 6 years ago

Implementation for #9

akshaysasidrn commented 6 years ago

@iffyuva I'm not sure about the approach that is taken. Rapidfire makes use of current_user for storing user data in Attempt model and can_administer? to check whether the user is authorizable and also for conditional links in views.

Now that pundit is added, Rapidfire views and authorization is dependant on user model which implies the consumer that uses the gem has to add can_administer? method for their user model.

I think the earlier approach was good. Giving the consumer a helper which he defines and we could simply move the before_filter :authenticate_user! to the controller actions. The functionality of pundit in scoping the records or denying authorization based on the attribute of a record is not used. We are only dependant on a single admin role.

stale[bot] commented 5 years ago

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs for another 14 days. Thank you for your contributions.