コード例 #1
0
ファイル: sites.py プロジェクト: Wawki/minion-backend
def get_sites():
    query = {}
    url = request.args.get('url')
    if url:
        query['url'] = url
    sitez = [sanitize_site(site) for site in sites.find(query)]
    for site in sitez:
        site['groups'] = _find_groups_for_site(site['url'])
    return jsonify(success=True, sites=sitez)
def get_sites():
    query = {}
    url = request.args.get('url')
    if url:
        query['url'] = url
    sitez = [sanitize_site(site) for site in sites.find(query)]
    for site in sitez:
        site['groups'] = _find_groups_for_site(site['url'])

    return jsonify(success=True, sites=sitez)
def _check_plan_by_email(email, plan_name):
    plan = plans.find_one({'name': plan_name})
    if not plan:
        return False
    sitez = sites.find({'plans': plan_name})
    if sitez.count():
        matches = 0
        for site in sitez:
            groupz = groups.find({'users': email, 'sites': site['url']})
            if groupz.count():
                matches += 1
        return matches
コード例 #4
0
ファイル: plans.py プロジェクト: ZaiLynch/minion-backend
def _check_plan_by_email(email, plan_name):
    plan = plans.find_one({'name': plan_name})
    if not plan:
        return False
    sitez = sites.find({'plans': plan_name})
    if sitez.count():
        matches = 0
        for site in sitez:
            groupz = groups.find({'users': email, 'sites': site['url']})
            if groupz.count():
                matches += 1
        return matches
コード例 #5
0
ファイル: sites.py プロジェクト: piykumar/minion-backend
def get_sites():
    query_url = request.args.get('url')
    if query_url:
        site = sites.find_one({'url': query_url})
        if site:
            site['groups'] = _find_groups_for_site(site['url'])
            return jsonify(success=True, site=sanitize_site(site))
        else:
            jsonify(success=True, site=[])
    else:
        sitez = [sanitize_site(site) for site in sites.find()]
        for site in sitez:
            site['groups'] = _find_groups_for_site(site['url'])
        return jsonify(success=True, sites=sitez)
コード例 #6
0
ファイル: sites.py プロジェクト: mozmark/minion-backend
def list_sites():
    sitez = [sanitize_site(site) for site in sites.find()]
    for site in sitez:
        site['groups'] = _find_groups_for_site(site['url'])
    return jsonify(success=True, sites=sitez)