app/soc/logic/models/user.py
changeset 722 a59eaa177562
parent 655 9635cbaa2dcd
child 744 cd9bf163473c
equal deleted inserted replaced
721:6f1d29857072 722:a59eaa177562
    19 
    19 
    20 __authors__ = [
    20 __authors__ = [
    21   '"Sverre Rabbelier" <sverre@rabbelier.nl>',
    21   '"Sverre Rabbelier" <sverre@rabbelier.nl>',
    22   ]
    22   ]
    23 
    23 
       
    24 
       
    25 from google.appengine.api import users
    24 
    26 
    25 from soc.logic.helper import notifications
    27 from soc.logic.helper import notifications
    26 from soc.logic.models import base
    28 from soc.logic.models import base
    27 
    29 
    28 import soc.models.user
    30 import soc.models.user
    51     for former_account_user in users_with_former_accounts: 
    53     for former_account_user in users_with_former_accounts: 
    52       if account in former_account_user.former_accounts:
    54       if account in former_account_user.former_accounts:
    53         return True
    55         return True
    54 
    56 
    55     return False
    57     return False
       
    58 
       
    59   def getForCurrentAccount(self):
       
    60     """Retrieves the user entity for the currently logged in account
       
    61 
       
    62     If there is no user logged in, or they have no associated User
       
    63     entity, None is returend.
       
    64     """
       
    65 
       
    66     account = users.get_current_user()
       
    67 
       
    68     if not account:
       
    69       return None
       
    70 
       
    71     user = self.getForFields({'account': account}, unique=True)
       
    72 
       
    73     return user
    56 
    74 
    57   def getKeyValues(self, entity):
    75   def getKeyValues(self, entity):
    58     """See base.Logic.getKeyValues.
    76     """See base.Logic.getKeyValues.
    59     """
    77     """
    60 
    78