Adds the possibility to exclude the user from the website.
getForCurrentAccount now only returns a user entity when it is valid.
Patch by: Lennard de Rijk
Reviewed by: to-be-reviewed
--- a/app/soc/logic/accounts.py Mon Feb 02 20:56:14 2009 +0000
+++ b/app/soc/logic/accounts.py Mon Feb 02 21:46:01 2009 +0000
@@ -68,7 +68,8 @@
account = current
if not user:
- user = models.user.logic.getForFields({'account': account}, unique=True)
+ user = models.user.logic.getForFields(
+ {'account': account, 'status': 'valid'}, unique=True)
if not user:
# no User entity for this Google Account, and account is not the
--- a/app/soc/logic/models/user.py Mon Feb 02 20:56:14 2009 +0000
+++ b/app/soc/logic/models/user.py Mon Feb 02 21:46:01 2009 +0000
@@ -71,7 +71,8 @@
if not account:
return None
- user = self.getForFields({'account': account}, unique=True)
+ user = self.getForFields({'account': account, 'status':'valid'},
+ unique=True)
return user
--- a/app/soc/views/helper/access.py Mon Feb 02 20:56:14 2009 +0000
+++ b/app/soc/views/helper/access.py Mon Feb 02 21:46:01 2009 +0000
@@ -463,7 +463,9 @@
self.checkIsLoggedIn(django_args)
- if not self.user and not user_logic.isFormerAccount(self.id):
+ user_entity = user_logic.getForFields({'account':self.id}, unique=True)
+
+ if not user_entity and not user_logic.isFormerAccount(self.id):
# this account has not been used yet
return