# HG changeset patch # User Lennard de Rijk # Date 1233611161 0 # Node ID b53fa1e05dbdae29380265dc8db180ae5d1f3725 # Parent bb530ca58bc5212748bf3a9e265b20359c03f26e 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 diff -r bb530ca58bc5 -r b53fa1e05dbd app/soc/logic/accounts.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 diff -r bb530ca58bc5 -r b53fa1e05dbd app/soc/logic/models/user.py --- 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 diff -r bb530ca58bc5 -r b53fa1e05dbd app/soc/views/helper/access.py --- 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