예제 #1
0
def ensureLoggedIn(data):
    """Ensures that the user is logged in.

  Args:
    data: request_data.RequestData for the current request.

  Raises:
    exception.LoginRequired: If the user is not logged in.
  """
    if not data.gae_user:
        raise exception.LoginRequired()
예제 #2
0
 def checkAccess(self, data, check):
     """See AccessChecker.checkAccess for specification."""
     if data.is_developer:
         # NOTE(nathaniel): Developers are given all the powers of
         # program administrators.
         return
     elif not data.gae_user:
         raise exception.LoginRequired()
     elif not user_logic.isHostForProgram(data.ndb_user,
                                          data.program.key()):
         raise exception.Forbidden(
             message=_MESSAGE_NOT_PROGRAM_ADMINISTRATOR)
예제 #3
0
 def isLoggedIn(self):
     """Ensures that the user is logged in."""
     if not self.data.gae_user:
         raise exception.LoginRequired()