Beispiel #1
0
        if params.certurl is not None:
            certurl = params.certurl
        if params.trackurl is not None:
            trackurl = params.trackurl

    except Exception, e:
        log.info("There are no params for %s: %s" % (username, str(e)))
        pass

    topic_list = []

    # Select list of topics for this user. Attempt to expand %u which the client
    # won't understand. %c loses out -- that won't work, so no point returning
    # those.
    try:
        for sub in Acl.select().where(Acl.username == username):
            if sub.topic.startswith('_'):    # FIXME this is temporary
                continue
            new_sub = sub.topic.replace('%u', username)
            if '%c' not in new_sub:
                # Ensure that CTRL get's correct topics. In particular, not more
                # than 3 'parts' ending in '#'

                parts = new_sub.split('/')
                nparts = len(parts)
                if new_sub.startswith('/'):
                    nparts = nparts - 1
                new_topic = new_sub
                if nparts > 3 and new_sub.endswith('/#'):
                    new_topic = new_sub[0:-2]
                topic_list.append(new_topic)
Beispiel #2
0
    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

    if not superuser:
        query = (Acl.select(Acl). where(
                    (Acl.username == username)
                ))
        sublist = [ q.topic for q in query.naive() ]
    else:
        sublist.append('#')

    # Find distinct topic, tid combinations in Locations table and
    # let Paho check if subscription matches

    topiclist = []
    tidlist = []

    query = (Location.select(Location.tid, Location.topic)
                    .distinct()
                    .order_by(Location.tid)
                    )
Beispiel #3
0
        if params.certurl is not None:
            certurl = params.certurl
        if params.trackurl is not None:
            trackurl = params.trackurl

    except Exception, e:
        log.info("There are no params for %s: %s" % (username, str(e)))
        pass

    topic_list = []

    # Select list of topics for this user. Attempt to expand %u which the client
    # won't understand. %c loses out -- that won't work, so no point returning
    # those.
    try:
        for sub in Acl.select().where(Acl.username == username):
            if sub.topic.startswith('_'):  # FIXME this is temporary
                continue
            new_sub = sub.topic.replace('%u', username)
            if '%c' not in new_sub:
                # Ensure that CTRL get's correct topics. In particular, not more
                # than 3 'parts' ending in '#'

                parts = new_sub.split('/')
                nparts = len(parts)
                if new_sub.startswith('/'):
                    nparts = nparts - 1
                new_topic = new_sub
                if nparts > 3 and new_sub.endswith('/#'):
                    new_topic = new_sub[0:-2]
                topic_list.append(new_topic)
Beispiel #4
0
    # 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

    if not superuser:
        query = (Acl.select(Acl).where((Acl.username == username)))
        sublist = [q.topic for q in query.naive()]
    else:
        sublist.append('#')

    # Find distinct topic, tid combinations in Locations table and
    # let Paho check if subscription matches

    topiclist = []
    tidlist = []

    query = (Location.select(Location.tid,
                             Location.topic).distinct().order_by(Location.tid))
    for q in query:
        for sub in sublist:
            if paho.topic_matches_sub(sub, q.topic):