Exemple #1
0
def index(slug):
    project = object_or_404(Project.by_slug(slug))
    authz.require(authz.project_manage(project))
    query = Permission.all()
    query = query.filter_by(project=project)
    pager = Pager(query, slug=slug)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)
Exemple #2
0
def index(slug):
    project = object_or_404(Project.by_slug(slug))
    authz.require(authz.project_manage(project))
    query = Permission.all()
    query = query.filter_by(project=project)
    pager = Pager(query, slug=slug)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)
Exemple #3
0
def index():
    alias = aliased(Entity)
    query = db.session.query(alias)
    query = filters.for_entities(query, alias)
    query = sorters.for_entities(query, alias)
    pager = Pager(query)
    validate_cache(keys=pager.cache_keys())
    result = pager.to_dict()
    result['facets'] = facets.for_entities()
    return jsonify(result, index=True)
Exemple #4
0
def index():
    alias = aliased(Relation)
    q = db.session.query(alias)
    query = filters.for_relations(q, alias)
    query = sorters.for_entities(query, alias)
    pager = Pager(query)
    validate_cache(keys=pager.cache_keys())
    result = pager.to_dict()
    result['facets'] = facets.for_relations()
    return jsonify(result, index=True)
Exemple #5
0
def _index(query, obj):
    authz.require(authz.project_read(obj.project))
    active_only = arg_bool('active', default=True)
    if active_only:
        query = query.filter_by(active=True)

    if 'name' in request.args:
        query = query.filter_by(name=request.args.get('name'))

    query = query.order_by(Property.created_at.desc())
    pager = Pager(query, obj_id=obj.id)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=False)
Exemple #6
0
def _index(query, obj):
    authz.require(authz.project_read(obj.project))
    active_only = arg_bool('active', default=True)
    if active_only:
        query = query.filter_by(active=True)

    if 'name' in request.args:
        query = query.filter_by(name=request.args.get('name'))

    query = query.order_by(Property.created_at.desc())
    pager = Pager(query, obj_id=obj.id)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=False)
Exemple #7
0
def index(pipeline_id):
    pipeline = object_or_404(Pipeline.by_id(pipeline_id))
    authz.require(authz.project_read(pipeline.project))

    query = LogEntry.all()
    query = query.filter(LogEntry.pipeline == pipeline)

    if request.args.get('level'):
        query = query.filter(LogEntry.level == request.args.get('level'))

    pager = Pager(query)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)
Exemple #8
0
def index(pipeline_id):
    pipeline = object_or_404(Pipeline.by_id(pipeline_id))
    authz.require(authz.project_read(pipeline.project))

    query = LogEntry.all()
    query = query.filter(LogEntry.pipeline == pipeline)

    if request.args.get('level'):
        query = query.filter(LogEntry.level == request.args.get('level'))

    pager = Pager(query)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)
Exemple #9
0
def index():
    query = File.all()
    query = query.join(Project)
    query = query.outerjoin(Permission)
    query = query.filter(or_(Project.private == False, # noqa
        and_(Permission.reader == True, # noqa
             Permission.account == request.account)))

    if request.args.get('project'):
        query = query.filter(Project.slug == request.args.get('project'))

    query = query.distinct()
    pager = Pager(query)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)
Exemple #10
0
def index():
    query = File.all()
    query = query.join(Project)
    query = query.outerjoin(Permission)
    query = query.filter(
        or_(
            Project.private == False,  # noqa
            and_(
                Permission.reader == True,  # noqa
                Permission.account == request.account)))

    if request.args.get('project'):
        query = query.filter(Project.slug == request.args.get('project'))

    query = query.distinct()
    pager = Pager(query)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)
Exemple #11
0
def index():
    query = Pipeline.all()
    query = query.join(Project)
    query = query.outerjoin(Permission)
    query = query.filter(or_(Project.private==False,
        and_(Permission.reader==True, Permission.account==request.account)))

    if request.args.get('project'):
        query = query.filter(Project.slug==request.args.get('project'))

    if request.args.get('operation'):
        query = query.filter(Pipeline.operation == request.args.get('operation'))

    query = query.order_by(Pipeline.updated_at.desc())
    query = query.distinct()

    pager = Pager(query)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)
Exemple #12
0
def index():
    query = Pipeline.all()
    query = query.join(Project)
    query = query.outerjoin(Permission)
    query = query.filter(
        or_(
            Project.private == False,
            and_(Permission.reader == True,
                 Permission.account == request.account)))

    if request.args.get('project'):
        query = query.filter(Project.slug == request.args.get('project'))

    if request.args.get('operation'):
        query = query.filter(
            Pipeline.operation == request.args.get('operation'))

    query = query.order_by(Pipeline.updated_at.desc())
    query = query.distinct()

    pager = Pager(query)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)
Exemple #13
0
def index():
    q = Project.all()
    q = q.filter(Project.id.in_(authz.permissions().get('reader')))
    pager = Pager(q)
    validate_cache(keys=pager.cache_keys())
    return jsonify(pager, index=True)