Beispiel #1
0
def add_query_execution_access_request(execution_id):
    uid = current_user.id
    access_request = AccessRequest.get(query_execution_id=execution_id, uid=uid)
    if not access_request:
        access_request = AccessRequest.create(
            {"query_execution_id": execution_id, "uid": uid}
        )
    send_query_execution_access_request_notification(execution_id=execution_id, uid=uid)
    return access_request
Beispiel #2
0
def add_query_execution_viewer(execution_id, uid):
    verify_query_execution_owner(execution_id)
    with DBSession() as session:
        viewer = QueryExecutionViewer.create(
            {
                "query_execution_id": execution_id,
                "uid": uid,
                "created_by": current_user.id,
            },
            commit=False,
            session=session,
        )
        access_request = AccessRequest.get(
            session=session, query_execution_id=execution_id, uid=uid
        )
        if access_request:
            AccessRequest.delete(id=access_request.id, session=session, commit=False)
        send_query_execution_invitation_notification(
            execution_id=execution_id, uid=uid, session=session
        )
        session.commit()
    return viewer.to_dict()
Beispiel #3
0
def delete_query_execution_access_request(execution_id, uid):
    verify_query_execution_owner(execution_id)
    access_request = AccessRequest.get(query_execution_id=execution_id,
                                       uid=uid)
    if access_request:
        AccessRequest.delete(id=access_request.id)