Esempio n. 1
0
class PistaAuth(object):
    def __init__(self):
        pass

    def check(self, username, password, apns_token=None):

        if username is None or password is None:
            log.error("Username {0} or password are None".format(username))
            return False

        try:
            db.connect()
        except Exception, e:
            log.error("%s" % str(e))
            return False

        pwhash = None
        try:
            u = User.get(User.username == username)
            pwhash = u.pwhash
        except User.DoesNotExist:
            log.debug("User {0} does not exist".format(username))
            return False
        except Exception, e:
            raise
Esempio n. 2
0
def getinventorytopics(username):
    ''' username is probably a logged-in user. Obtain a list of TIDs
        that user is allowed to see '''

    # First, get a list of ACL topics the user is authorized for. If the
    # `username' is a superuser, add '#' to the subscription list, so
    # that paho matches that as true in any case. (Superusers possibly
    # don't have ACL entries in the database.)

    sublist = []

    superuser = False
    try:
        u = User.get(User.username == username)
        superuser = u.superuser
    except User.DoesNotExist:
        log.debug("User {0} does not exist".format(username))
        return []
    except Exception, e:
        raise
Esempio n. 3
0
def getinventorytopics(username):
    ''' username is probably a logged-in user. Obtain a list of TIDs
        that user is allowed to see '''

    # First, get a list of ACL topics the user is authorized for. If the
    # `username' is a superuser, add '#' to the subscription list, so
    # that paho matches that as true in any case. (Superusers possibly
    # don't have ACL entries in the database.)

    sublist = []

    superuser = False
    try:
        u = User.get(User.username == username)
        superuser = u.superuser
    except User.DoesNotExist:
        log.debug("User {0} does not exist".format(username))
        return []
    except Exception, e:
        raise