Adds the possibility to exclude the user from the website.
authorLennard de Rijk <ljvderijk@gmail.com>
Mon, 02 Feb 2009 21:46:01 +0000
changeset 1192 b53fa1e05dbd
parent 1191 bb530ca58bc5
child 1193 8d3a7e8d88bd
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
app/soc/logic/accounts.py
app/soc/logic/models/user.py
app/soc/views/helper/access.py
--- 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