app/soc/logic/models/user.py
changeset 1600 0aa3de1b2acc
parent 1534 0a8dbeccf0d9
child 2345 f78caf12f32d
equal deleted inserted replaced
1599:b56976cac36b 1600:0aa3de1b2acc
    66 
    66 
    67     If there is no user logged in, or they have no valid associated User
    67     If there is no user logged in, or they have no valid associated User
    68     entity, None is returned.
    68     entity, None is returned.
    69     """
    69     """
    70 
    70 
    71     account = users.get_current_user()
    71     account = accounts.getCurrentAccount()
    72 
    72 
    73     if not account:
    73     if not account:
    74       return None
    74       return None
    75 
    75 
    76     return self.getForAccount(account)
    76     return self.getForAccount(account)
   100     Args:
   100     Args:
   101       account: if not supplied, defaults to the current account
   101       account: if not supplied, defaults to the current account
   102       user: if not specified, defaults to the current user
   102       user: if not specified, defaults to the current user
   103     """
   103     """
   104 
   104 
       
   105     current = accounts.getCurrentAccount()
       
   106 
   105     if not account:
   107     if not account:
   106       # default account to the current logged in account
   108       # default account to the current logged in account
   107       account = users.get_current_user()
   109       account = current
   108 
   110 
   109     if account and (not user):
   111     if account and (not user):
   110       # default user to the current logged in user
   112       # default user to the current logged in user
   111       user = self.getForAccount(account)
   113       user = self.getForAccount(account)
   112 
   114 
   113     if user and user.is_developer:
   115     if user and user.is_developer:
   114       return True
   116       return True
   115 
   117 
   116     if account and (account == users.get_current_user()):
   118     if account and (account == current):
   117       return users.is_current_user_admin()
   119       return users.is_current_user_admin()
   118 
   120 
   119   def agreesToSiteToS(self, entity):
   121   def agreesToSiteToS(self, entity):
   120     """Returns indication of User's answer to the site-wide Terms of Service.
   122     """Returns indication of User's answer to the site-wide Terms of Service.
   121 
   123