arooo icon indicating copy to clipboard operation
arooo copied to clipboard

Make user not admin when user becomes former member

Open compwron opened this issue 6 years ago • 6 comments

We want to do this so that it is less confusing to see a list of admins / because it makes the data cleaner.

User.is_admin
User.state == 'former_member'

This isn't really a security issue because former members can't log in but because it has to do with permissions I tagged it security anyway :)

This description is not very easy to understand, I hope to improve it later

compwron avatar Sep 04 '19 17:09 compwron

@compwron can you assign this issue to me?

GaganGupta19 avatar Oct 13 '19 18:10 GaganGupta19

@GaganGupta19 I assigned the issue to you :) Thanks for working on this! :)

compwron avatar Oct 15 '19 04:10 compwron

Unassigned this issue so that it is clearer that it is up for grabs, since there's been no activity for a while. @GaganGupta19 if you still want to work on this, you're very welcome! (Let me know if you need help/support with it.)

anaulin avatar Sep 26 '20 20:09 anaulin

@anaulin sure I am going to work on this

GaganGupta19 avatar Sep 27 '20 19:09 GaganGupta19

Oh, cool! Thank you!

Off the top of my head, you could implement this by hooking into the state change when a user goes into state former_member and marking them as non-admin at that point. We have an example of how to do that when we disable user's door codes, here: https://github.com/doubleunion/arooo/blob/master/app/models/user.rb#L121-L123 (This uses the state_machines gem, documentation here: https://www.rubydoc.info/github/state-machines/state_machines-activerecord/StateMachines/Integrations/ActiveRecord )

anaulin avatar Sep 27 '20 21:09 anaulin

@anaulin sure ! will do this ! Thanks for your suggestion ! :)

GaganGupta19 avatar Sep 28 '20 20:09 GaganGupta19