Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/maximemoreillon/group_manager

A NodeJS application to manage groups of users in a Neo4J database
https://github.com/maximemoreillon/group_manager

express neo4j nodejs

Last synced: about 1 month ago
JSON representation

A NodeJS application to manage groups of users in a Neo4J database

Awesome Lists containing this project

README

        

# Group manager

[![pipeline status](https://gitlab.com/moreillon_k8s/group-manager/group_manager_neo4j/badges/master/pipeline.svg)](https://gitlab.com/moreillon_k8s/group-manager/group_manager_neo4j)
[![coverage report](https://gitlab.com/moreillon_k8s/group-manager/group_manager_neo4j/badges/master/coverage.svg)](https://gitlab.com/moreillon_k8s/group-manager/group_manager_neo4j)
[![Artifact Hub](https://img.shields.io/endpoint?url=https://artifacthub.io/badge/repository/moreillon)](https://artifacthub.io/packages/search?repo=moreillon)

As a graph database Neo4jis a great choice to manage highly relational data. On the other side, a great number of applications feature at least some form of user management system. With Neo4j, those users can be store as nodes and connected to other items via relationships. A typical example would be a blog, where both articles and users are individual nodes while authorships are represented by a relationship.

When dealing with a large number of users, it can become convenient to arrange those in groups. Here, groups too can be represented as nodes and the membership of a user by a relationship. However, building group management logic from scratch for every application would be tedious.

![Example graph](docs/6149cfd89a075fff8259b929.png)

This microservice, named Group manager, proposes a solution to this problem by offering just the generic logic to handle groups and their relationships, making it easy to integrate in a microservice architecture, alongside other services managing Neo4j records.

The application is built using Node.js and the Express framework.

An example of application relying on Group manager is [申請マネージャ](https://github.com/jtekt/web-based-approval-system), A web based approval system for application forms and other documents

For more information, please visit the project page [here](https://articles.maximemoreillon.com/articles/398)

## API

### Groups

| Endpoint | Method | query/body | Description |
| --------------------------- | ------ | ---------- | -------------------------------------------------------------------- |
| /v3/groups/ | GET | tbd | Returns list of groups |
| /v3/groups/ | GET | tbd | Returns list of groups |
| /v3/groups/{group_id} | GET | - | Returns information about the group corresponding to the provided ID |
| /v3/groups/{group_id} | PATCH | properties | Updates properties of a group |
| /v3/groups/{group_id} | DELETE | - | Deletes a group |
| /v3/groups/{group_id}/join | POST | - | Join a group |
| /v3/groups/{group_id}/leave | POST | - | leave a group |

### Subgroups

| Endpoint | Method | query/body | Description |
| ------------------------------------------ | ------ | ---------- | -------------------------------------------------------------------- |
| /v3/groups/{group_id}/groups | GET | - | Returns the groups belonging to the group with the given ID |
| /v3/groups/{group_id}/groups/direct | GET | - | Returns the groups directly belonging to the group with the given ID |
| /v3/groups/{group_id}/parent_groups | GET | - | Returns the groups to which the group with the given ID belongs |
| /v3/groups/{group_id}/groups/{subgroup_id} | POST | - | Puts a group into another |
| /v3/groups/{group_id}/groups/{subgroup_id} | DELETE | - | Removes a subgroup from a group |

### Members

| Endpoint | Method | query/body | Description |
| --------------------------------------- | ------ | ---------- | ------------------------------------------------------------------------------ |
| /v3/groups/none/members | GET | - | Returns users without a group |
| /v3/groups/{group_id}/members | GET | - | Returns the users belonging to the group with the given ID |
| /v3/groups/{group_id}/members/{user_id} | POST | - | Adds a user to the group |
| /v3/groups/{group_id}/members/{user_id} | DELETE | - | Removes a user from the group |
| /v3/members/groups | GET | user_ids | Gets the groups of multiple users identrified by their respective IDs |
| /v3/members/{member_id}/groups | GET | - | Gets the groups of a member, here, use 'self' as member_id of one's own groups |

### Administrators

| Endpoint | Method | query/body | Description |
| ------------------------------------------------------- | ------ | ---------- | ------------------------------------------------------------------------------------------ |
| /v3/groups/{group_id}/administrators | GET | - | Returns the administrators of the group with the given ID |
| /v3/groups/{group_id}/administrators/{administrator_id} | POST | - | Adds an administrator to the group |
| /v3/groups/{group_id}/administrators/{administrator_id} | DELETE | - | Removes an administrator from the group |
| /v3/administrators/{administrators_id}/groups | GET | - | Gets the groups administrated by a user, here, use 'self' as member_id of one's own groups |

### Pagination

To limit the size of responses, groups, members and administrators are provided in a paginated manner. The page size and index of the first item on the page can be defined using the query parameters 'batch_size' and 'start_index' respectively.

## Environment variables

| Variable | Description |
| ------------------- | --------------------------------------------------------------------------------------- |
| APP_PORT | Application that the app listens on |
| NEO4J_URL | URL of the Neo4j database |
| NEO4J_USERNAME | Username for the Neo4j database |
| NEO4J_PASSWORD | Password for the Neo4j database |
| OIDC_JWKS_URI | URI for the JWKS of by the OAuth provider |
| IDENTIFICATION_URL | URL of the user identification endpoint (legacy) |
| DB_USER_ID_FIELDS | Fields of a Neo4J user record that can be used as identifier |
| AUTH_USER_ID_FIELDS | Fields of the user profile provided by the auth provider that can be used as identifier |

## Docker image

[![dockeri.co](https://dockeri.co/image/moreillon/group-manager)](https://hub.docker.com/r/moreillon/group-manager)