There needs to be an option that is more granular than just "staff?" for impersonation. I'd like to see a method option where you can specify "can_impersonate?(user_id)" and then let the model make tests against that user.
For example: I might have customer service staff who I need to allow to impersonate customers, but I would never want them to be able to impersonate an administrator. So, my implementation of can_impersonate? would reject it if the impersonated account were an admin.
This is a definite need in our project so I'm going to try to add it in and submit a pull request, but wanted to post this first just in case there was already a way to do this and I was missing it. As far as I can tell staff? doesn't pass anything in.
There needs to be an option that is more granular than just "staff?" for impersonation. I'd like to see a method option where you can specify "can_impersonate?(user_id)" and then let the model make tests against that user.
For example: I might have customer service staff who I need to allow to impersonate customers, but I would never want them to be able to impersonate an administrator. So, my implementation of can_impersonate? would reject it if the impersonated account were an admin.
This is a definite need in our project so I'm going to try to add it in and submit a pull request, but wanted to post this first just in case there was already a way to do this and I was missing it. As far as I can tell staff? doesn't pass anything in.