예제 #1
0
def update(id):
    relation = object_or_404(Relation.by_id(id))
    authz.require(authz.project_edit(relation.project))
    data = request_data({'author': request.account})
    relation = relations.save(data, relation=relation)
    db.session.commit()
    return jsonify(relation)
예제 #2
0
def update(id):
    entity = object_or_404(Entity.by_id(id))
    authz.require(authz.project_edit(entity.project))
    data = request_data({'author': request.account})
    entity = entities.save(data, entity=entity)
    db.session.commit()
    return jsonify(entities.to_rest(entity))
예제 #3
0
def update(id):
    relation = object_or_404(Relation.by_id(id))
    authz.require(authz.project_edit(relation.project))
    data = request_data({'author': request.account})
    relation = relations.save(data, relation=relation)
    db.session.commit()
    return jsonify(relations.to_rest(relation))
예제 #4
0
def update(id):
    entity = object_or_404(Entity.by_id(id))
    authz.require(authz.project_edit(entity.project))
    data = request_data({'author': request.account})
    entity = entities.save(data, entity=entity)
    db.session.commit()
    return jsonify(entities.to_rest(entity))
예제 #5
0
def create():
    data = request_data({'author': request.account})
    project = ProjectRef().get(data.get('project'))
    data['project'] = project
    authz.require(authz.project_edit(project))
    relation = relations.save(data)
    db.session.commit()
    return jsonify(relations.to_rest(relation))
예제 #6
0
파일: files_api.py 프로젝트: jacqui/grano
def create():
    data = request_data({'author': request.account})
    project = ProjectRef().get(data.get('project'))
    data['project'] = project
    authz.require(authz.project_edit(project))
    file_ = files.save(data, request.files.get('file'))
    db.session.commit()
    return jsonify(file_)
예제 #7
0
def create():
    data = request_data({'author': request.account})
    project = ProjectRef().get(data.get('project'))
    data['project'] = project
    authz.require(authz.project_edit(project))
    file_ = files.save(data, request.files.get('file'))
    db.session.commit()
    return jsonify(file_)
예제 #8
0
def create():
    data = request_data({'author': request.account})
    project = ProjectRef().get(data.get('project'))
    data['project'] = project
    authz.require(authz.project_edit(project))
    relation = relations.save(data)
    db.session.commit()
    return jsonify(relation)
예제 #9
0
def create():
    data = request_data({'author': request.account})
    project = ProjectRef().get(data.get('project'))
    data['project'] = project
    authz.require(authz.project_edit(project))
    entity = entities.save(data)
    db.session.commit()
    return jsonify(entities.to_rest(entity))
예제 #10
0
def merge():
    validator = entities.MergeValidator()
    data = validator.deserialize(request_data())
    authz.require(authz.project_edit(data['orig'].project))

    if data['orig'].id == data['dest'].id:
        raise BadRequest('Origin and destination are identical.')

    if data['orig'].project_id != data['dest'].project_id:
        raise BadRequest('Entities belong to different projects.')

    dest = entities.merge(data['orig'], data['dest'])
    db.session.commit()
    return jsonify(dest)
예제 #11
0
def merge():
    validator = entities.MergeValidator()
    data = validator.deserialize(request_data())
    authz.require(authz.project_edit(data['orig'].project))

    if data['orig'].id == data['dest'].id:
        raise BadRequest('Origin and destination are identical.')

    if data['orig'].project_id != data['dest'].project_id:
        raise BadRequest('Entities belong to different projects.')

    dest = entities.merge(data['orig'], data['dest'])
    db.session.commit()
    return jsonify(dest)
예제 #12
0
def perform_import(slug):
    project = object_or_404(Project.by_slug(slug))
    authz.require(authz.project_edit(project))
    data = request_data({'project': project})
    pipeline = imports.make_importer(project, request.account, data)
    return jsonify(pipeline)
예제 #13
0
def delete(id):
    entity = object_or_404(Entity.by_id(id))
    authz.require(authz.project_edit(entity.project))
    entities.delete(entity)
    db.session.commit()
    raise Gone()
예제 #14
0
def delete(id):
    relation = object_or_404(Relation.by_id(id))
    authz.require(authz.project_edit(relation.project))
    relations.delete(relation)
    db.session.commit()
    raise Gone()
예제 #15
0
파일: files_api.py 프로젝트: jacqui/grano
def delete(id):
    file_ = object_or_404(File.by_id(id))
    authz.require(authz.project_edit(file_.project))
    entities.delete(file_)
    db.session.commit()
    raise Gone()
예제 #16
0
def perform_import(slug):
    project = object_or_404(Project.by_slug(slug))
    authz.require(authz.project_edit(project))
    data = request_data({'project': project})
    pipeline = imports.make_importer(project, request.account, data)
    return jsonify(pipeline)
예제 #17
0
def delete(id):
    file_ = object_or_404(File.by_id(id))
    authz.require(authz.project_edit(file_.project))
    entities.delete(file_)
    db.session.commit()
    raise Gone()
예제 #18
0
def delete(id):
    entity = object_or_404(Entity.by_id(id))
    authz.require(authz.project_edit(entity.project))
    entities.delete(entity)
    db.session.commit()
    raise Gone()
예제 #19
0
def delete(id):
    relation = object_or_404(Relation.by_id(id))
    authz.require(authz.project_edit(relation.project))
    relations.delete(relation)
    db.session.commit()
    raise Gone()