Opened 13 years ago

Last modified 8 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 Christopher Allan Webber)

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 Christopher Allan Webber, 13 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 Aaron Williamson, 13 years ago

Owner: set to Elvenlord Elrond
Status: NewFeedback
I bit this bite-sized task today. Relevant branch is
[https://gitorious.org/\ :sub:`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 Elrond, 13 years ago

Owner: changed from Elvenlord Elrond to Aaron Williamson
Status: FeedbackIn 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:4 by Will Kahn-Greene, 13 years ago

The original url for this bug was http://bugs.foocorp.net/issues/390 .

comment:5 by Christopher Allan Webber, 12 years ago

Description: modified (diff)

I think we need #697 in order to really do this right.

Note: See TracTickets for help on using tickets.