Opened 15 years ago
Last modified 10 years ago
#103 closed defect
Change user status into a boolean, "active" or "is_active" — at Version 5
| Reported by: | Christopher Allan Webber | Owned by: | Aaron Williamson |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | programming | Keywords: | small |
| Cc: | aaronw | Parent Tickets: |
Description (last modified by )
Currently we have status being one of "active" or 'needs_email_verification'... we could simplify things by just having email_verified (which we already have) and "active" be a boolean.
The role of active will then switch to whether or not the user is enabled. You might set active to False if a user was abusing their account, for instance.
The migration on this should be pretty easy... just remove needs_email_verification and make all existing users active, since currently we don't have any inactive state.
This is a bitesized task.
Change History (5)
comment:1 by , 15 years ago
- Update the auth views
- you should be sure to update tests
- gmg user commands
- and the active user decorator.
- submission views? Might be handled by above.
comment:2 by , 15 years ago
| Owner: | set to |
|---|---|
| Status: | New → Feedback |
I bit this bite-sized task today. Relevant branch is [https://gitorious.org/copiesofcopies/mediagoblin/copiesofcopies-mediagoblin/commits/feature390_user_status_to_boolean](https://gitorious.org/copiesofcopies/mediagoblin/copiesofcopies-mediagoblin/commits/feature390_user_status_to_boolean)
comment:3 by , 15 years ago
| Owner: | changed from to |
|---|---|
| Status: | Feedback → In Progress |
Thanks for starting at this!
I think, there was a misunderstanding somewhere.
We currently have two states: "needs email verification" and "active". Those are currently mirrored in the .email_verified bool. So in theory we could completely drop the .status field and use the .email_verified field everywhere instead! That said: Please really just drop it in your migration.
We could stop here.
Instead we want a new field .is_active, so that users could be de-activated later on. That field should be True by default! We want active users! And it's, what the behaviour is till now. That said: Just add it as a new field in your migration with a default of True. Thing done.
Now to the gory details:
Most code probably wants to check for a "fully active user". In the new modell this is a user with .is_active==True (can login) and .email_verified==True (can do everything, because verified their email).
So it might make sense to have a "@property is_full_user(self): return self.is_active && self.email_verified" on the Mixin class to allow easy access everywhere.
And a bunch of db queries likely will need to check both variables.
A few places though (all those dealing with email verification, likely) will be happy with a .is_active==True only. Because they only require a user that has not been actively disabled.
I hope all this makese sense (especialy after the talk on irc).
comment:5 by , 13 years ago
| Description: | modified (diff) |
|---|
I think we need #697 in order to really do this right.
