Exemplo n.º 1
0
    def update_entity(self, entity, collection):
        category = REQUEST_TYPES.get(entity.get('ticket_type'))
        if category is None:
            return

        data = {
            'identifiers': [
                {
                    'schema': 'idashboard',
                    'identifier': entity.get('id')
                }
            ],
            'other_names': [],
            'name': entity.get('name'),
            '$schema': category
        }
        ent = Entity.by_identifier('idashboard', entity.get('id'),
                                   collection.id)
        if ent is not None:
            data['id'] = ent.id

        ent = Entity.save(data, merge=True)
        db.session.flush()
        return ent
Exemplo n.º 2
0
    def update_entity(self, entity, collection):
        category = REQUEST_TYPES.get(entity.get('ticket_type'))
        if category is None:
            return

        data = {
            'identifiers': [{
                'schema': 'idashboard',
                'identifier': entity.get('id')
            }],
            'other_names': [],
            'name':
            entity.get('name'),
            '$schema':
            category
        }
        ent = Entity.by_identifier('idashboard', entity.get('id'),
                                   collection.id)
        if ent is not None:
            data['id'] = ent.id

        ent = Entity.save(data, merge=True)
        db.session.flush()
        return ent
Exemplo n.º 3
0
def lookup():
    entity = obj_or_404(
        Entity.by_identifier(request.args.get('scheme'),
                             request.args.get('identifier')))
    authz.require(authz.collection_read(entity.collection_id))
    return jsonify(entity)
Exemplo n.º 4
0
def lookup():
    entity = obj_or_404(
        Entity.by_identifier(request.args.get('scheme'),
                             request.args.get('identifier')))
    check_authz(entity, authz.READ)
    return jsonify(entity)
Exemplo n.º 5
0
def lookup():
    entity = obj_or_404(Entity.by_identifier(request.args.get('scheme'),
                                             request.args.get('identifier')))
    authz.require(authz.collection_read(entity.collection_id))
    return jsonify(entity)
Exemplo n.º 6
0
def lookup():
    entity = obj_or_404(Entity.by_identifier(request.args.get('scheme'),
                                             request.args.get('identifier')))
    check_authz(entity, authz.READ)
    return jsonify(entity)