Git Product home page Git Product logo

negotiator's Introduction

Negotiator

build codecov Static Badge Static Badge

Negotiator, an open-source access management solution featuring a customizable workflow engine, along with messaging, notifications and moderation support.

Goal

This project aims to develop an extensively customizable access management system designed to efficiently structure and streamline the process of resource access requests within multinational research infrastructures.

State

Negotiator is currently used for mediating access to biological data and samples in BBMRI-ERIC. Using one of BBMRI-ERIC discovery services such as the Directory or the GBA SampleLocator researchers can browse and locate collections of bio specimens, and then request access via BBMRI-ERIC Negotiator by filling out a request form and then following individual steps of the Negotiation lifecycle. This is a new implementation of the Negotiator, version 3.0.0 and is still under active development. Reference UI implementation for BBMRI can be found in this repository. Documentation for the new REST API can be found here. An older version of this service can be found in this repository.

The Negotiator as an Access Management System:

Key Domain entities:

  • Resource: Any resource/entity that is listed in an external discovery service, and has a unique and persistent identifier. (e.g., collection of biological samples, research service, specialized treatment...)
  • Request: A depiction of a query from a data discovery service specifying the resource/resources of interest and filtering criteria used to find them in the discovery service.
  • Negotiation: An access application consisting of one or multiple requests that is linked to an authenticated user.
  • Representative: A physical person responsible for mediating access to a resource in their jurisdiction.

Basic usage example

Using an external discovery service connected to the Negotiator, the user identifies resources they are interested in getting access to, and passes them as a Request to the Negotiator. Once authenticated, the user then fills out a resource-specific access form and submits the request for review. Once the request is approved by an administrator, it becomes a Negotiation where resource representatives, moderators and the requester can interact with it.

Quick Start

Negotiator application can also be spun up using the provided Docker image. To run the application with a mock authorization server using the OAuth2 protocol, see this docker compose file.

To create a request and start the access workflow, run the following curl command:

curl --location 'http://localhost:8080/api/v3/requests' \
--header 'Content-Type: application/json' \
--data '{
    "url": "https://bbmritestnn.gcc.rug.nl",
    "humanReadable": "#1: No filters used.\r\n#2: No filters used.",
    "resources": [{
        "id": "bbmri-eric:ID:CZ_MMCI:collection:LTS"
    }]
}'

Development

For contributing, please read our contribution guidelines.

Prerequisites

  • Java 17
  • Maven
  • Spring
  • Docker engine

Running the backend in dev mode

mvn clean spring-boot:test-run -Dspring-boot.run.profiles=dev 

The dev mode requires a relational database, details can be found below.

Connection URL for the Postgres test container database

Using the springboot test containers, the application spins up a postgres database. Default credentials are: negotiator:negotiator jdbc:postgresql://localhost:5432/negotiator

System architecture

Documentation for individual components:

License

Copyright 2020-2024 BBMRI-ERIC.

Licensed under GNU Affero General Public License v3.0 (the "License"); you may not use this file except in compliance with the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

negotiator's People

Contributors

asulis avatar dependabot[bot] avatar holubp avatar jungwire avatar radovantomik avatar reihsr avatar svituz avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

negotiator's Issues

[FEATURE] Add support for private posts

Brief description.
We need to add support for priavte posts between a researcher and representatives of a specific resource. For now support only 1:1 communication.

Desired functionality acceptance criteria

  • When a public post is created it's resourceId is set to null.
  • When a private post is created it is attached to a resource.
  • Private posts can be obtained only be resource represnetatives or the researcher who created the negotiation it is attached to.

[BUG] Representative receives not approved negotiations

Describe the bug
When fetching negotiations from the backend the rep receives not approved Negotiations.
How to reproduce

  • Create new negotiation
  • View the rep window
    What happens
    The rep sees not approved negotiations.
    What should happen
    They should see only ongoing negotiations

[FEATURE] Add support for message threads.

Brief description.
We need to add a way to group messages into threads. This should be possible for both private(1:1) and public messages/posts.

Desired functionality acceptance criteria

  • The maximum nesting depth is 1
  • Test it with 10 nested messages

[FEATURE] Add support for attachments.

Brief description.
Create an endpoint for uploading file attachments such as PDFs.

Desired functionality acceptance criteria
An authenticated user can upload an attachemnt.
The attachment is linked to a negotiation.
The attachment can be pulled using HTTP Get.

[FEATURE] History for changes in the Resource State Machine

Brief description.
For auditing and debuggin purposes it would be beneficial to store history of changes in the DB.

Desired functionality acceptance criteria

  • For every change there should be a new record containing: timestamp, old state, new state, chagned by

[BUG] Error getting roles from backend

Describe the bug
If a new user that is not already present in the DB then getting roles fails with 500 for the first time because it's trying to also get all negotiations at the same time.
How to reproduce
Login as a new user.
What happens
HTTP 500
What should happen
HTTP 200 and the user should only see relevant tabs.

[FEATURE] Migrate v2 database

Brief description.
We need to migrate data from v2 database.

Desired functionality acceptance criteria

  • All relevant data is supported by v3.

Implement private posts

Brief description.
Implement private posts functionality. This allows to exchange messages related to a specific resource that is part of a negotiation.

Desired functionality acceptance criteria

  • Posts can both be private or public, with an appropriate attribute. A private post must have an associated resource it is related to
  • The API operations in Posts Controller are able to deal with private posts only, public posts, or both

[FEATURE] Add User API controller

Brief description.
We need a way to get User roles from the backend.
Example DTO returned from /user: {roles : ["ADMIN", "RESEARCHER", "REPRESENTATIVE","biobank1:collection1"]}

Desired functionality acceptance criteria

  • The endpoint is only for authenticated users.
  • It returns a DTO with structure mentioned above

[FEATURE] Add syncing of collections from Molgenis

Brief description.
We need a way to sync/verify resources with Molgenis (Potentionally other discovery services).

Desired functionality acceptance criteria

  • You can specify a directory URL for sync
  • Using REST API the Negotiator tries to pull any unknown collections

[BUG] SQL script init inserts same datasource on each restart

Describe the bug
SQL script init inserts same datasource on each restart
How to reproduce
Spin up with a postgres DB and restart the app.
What happens
Same datasource was inserted for the second time.
What should happen
There should be only one datasource.

[FEATURE] Better logging

Brief description.
Add more loging calls with a clear way how to specify logging level.

Desired functionality acceptance criteria
More concise logs with an env for logging level.

[BUG] Add validation for access criteria fields

Describe the bug
You can post anything to the create negotiation endpoint.
How to reproduce
Create request and negotiation using postman.
What happens
A negotiation is created even though you have provided a payload that does not match the access criteria.
What should happen
You should receive a 400 error.

Fix swagger UI

The goal is to have a working swagger UI for API documentation and testing

[BUG] Negotiation state gets reset

Describe the bug
Negotiation state gets reset when getting all negotiations after restarting the database
How to reproduce

  1. Create negotiation
  2. Update state
  3. Restart DB
  4. Look at negotiations in the frontend

What happens
The negotiation state is reset.
What should happen
The negotiation state should not be reset.

[TEST] Refactor the integration tests

Brief description.
The system currently lacks a good e2e and integration tests setup verifying the functionality of the system as a whole.
Desired functionality acceptance criteria

  • Use postgres test-containers
  • Move db init into code
  • Each test needs to be self contained
  • Mock auth using JWT not basic auth

Improve attachments structure

Brief description.
Currently, the metadata of an attachment in the Negotiation response is duplicated in the attachments field and in the related field in the payload. We should think of a more effective way to represent the attachments

Refactor the test suite

In order to make the test suite more flexible it's needed to rewrite most of the e2e tests into unit tests.

Remove the nested structure of request resources

To remove unneeded complexity we should remove the nesting of resources in a request entity. Instead of this we should use a new nested Organization entity to handle additional information about parent institution.

Token expires even if the OIDC session is still valid

Description

If the access token is expired, the user seems logged in (i.e., the AAI session is still valid), but the calls to the backend fail with 401 Unauthorized

How to reproduce

  1. Login into the negotiator
  2. Wait until the token expires (by default 3600 seconds)
  3. Try to refresh the page

What happens

The user is logged in (indeed the user name is shown in the header) but it is not possible to access the backend

What should happen

The calls to the backend should succeed

Refactor Perun classes

Setup correct authentication flow. Keep in mind the capability to use multiple tabs.
Generalise the Perun classes.

[FEATURE] Add notifications for comments and state changes

Brief description.

ROLE: Researcher, Representative

Negotiator needs to send notifications for any changes to relevant requests, specifically comments and state changes. The implementation should maybe include a Notification entity: who, which request, What changed, when, wasRead.

Desired functionality acceptance criteria

  • Each change of state, new comment generates a new Notification
  • A REST API endpoint for pulling all notifications for user
  • A REST API endpoint for pulling any unread notifications for user
  • A REST API endpoint for marking notifications as read

Create request

Create an endpoint that accepts POST from an outside service and responds with a redirect URL for filling out a form specific to this received request.

  • Receive post request
  • Save NegotiationRequest
  • Respond with RedirectURL

[BUG] Error when abandoning a negotiation as a researcher

Describe the bug
When a Researcher tries to abandon a negotiation, it gets a 403 forbidden response

How to reproduce

  • Create a Request
  • Create a Negotiation
  • Try to abandon the Negotiation as a Researcher (i.e., PUT /negotiations/{id}/lifecycle/ABANDON)

What happens
The backend returns a 403 Forbidden response

What should happen
The backend should return 204 No Content and the negotiation status should be updated

Notes
The bug is related to the condition in the NegotiationController for methods sendEvent

if (!NegotiatorUserDetailsService.isCurrentlyAuthenticatedUserAdmin()) {
    throw new ResponseStatusException(HttpStatus.FORBIDDEN);
}

Probably, also as Biobanker the user would get a 403 Forbidden

[BUG] Enum checks in REST controllers

Describe the bug
The REST controller does not verify validity of ENUM values.
How to reproduce
Send fake event to lifecycle endpoint.
What happens
500 server error.
What should happen
Wrong request with description.

[FEATURE] Set a default access criteria template

Brief description.
We currently have just a stub access criteria form and we need to copy over the default BBMRI-ERIC template from V2.
Desired functionality acceptance criteria

  • The template for every collection looks exactly like the one in v2.

[FEATURE] Add listing of all requests for Admin

Brief description.
We need a way for the Admin to get all Negotiations that are in state "SUBMITTED".

Desired functionality acceptance criteria

  • Admin is assigned role based on perun claims
  • Admin can request all negotiations to be accepted
  • User without Admin role will get 401 error

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.