Exemplo n.º 1
0
    def testAccessGranted(self):
        _, mr = testing_helpers.GetRequestObjects(path='/hosting')
        # No exceptions should be raised.
        servlet_helpers.AssertBasePermission(mr)

        mr.auth.user_id = 123
        # No exceptions should be raised.
        servlet_helpers.AssertBasePermission(mr)
        servlet_helpers.AssertBasePermissionForUser(mr.auth.user_pb,
                                                    mr.auth.user_view)
Exemplo n.º 2
0
    def AssertBasePermission(self, mr):
        """Make sure that the logged in user has permission to view this page.

    Subclasses should call super, then check additional permissions
    and raise a PermissionException if the user is not authorized to
    do something.

    Args:
      mr: commonly used info parsed from the request.

    Raises:
      PermissionException: If the user does not have permisssion to view
        the current page.
    """
        servlet_helpers.AssertBasePermission(mr)