doubleunion / arooo

Membership management for hacker/makerspaces
GNU General Public License v3.0
66 stars 55 forks source link

Make user not admin when user becomes former member #384

Open compwron opened 5 years ago

compwron commented 5 years ago

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

GaganGupta19 commented 4 years ago

@compwron can you assign this issue to me?

compwron commented 4 years ago

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

anaulin commented 3 years ago

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.)

GaganGupta19 commented 3 years ago

@anaulin sure I am going to work on this

anaulin commented 3 years ago

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 )

GaganGupta19 commented 3 years ago

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