1.2.3.3 Authenticating the Signed In User

Once we have checked a user is signed in using auth.signedInUser != None we can authorise the user. The .signedInUser attribute of the manager object will contain a user object for the signed in user. The user object has an authorise() method which can be used to check the user's access priveledges. The method returns False if the user does not meet all the authorisation criteria and True otherwise.

        if auth.signedInUser.authorise(app='app', level=1):
            print "Signed in successfully and authorised"
        else:
            print "Not authorised to use this application"

The authorise() method takes a number of parameters for more advanced authorisation functionality.