API to manage our users from the apps in keycloak
🏠 Homepage
The API is made in nodejs using hapi.
nodejs is required
export NODE_ENV=development
node server.js or npm start
This will launch a nodejs web server using the .env.development environment variable file and exposing the port 3000 of your computer.
There are 5 endpoints that are used to manage the users between the database of the apps and keycloak :
GET /users
Rights : This endpoint is only available to connected users having the "adminentreprise" role into the armadacar app and will only retrive users that are in the company of the caller. It is also accessible by users in entreprise-management-admin role with nos restrictions.
GET /user/{id}
Rights : This endpoint is only available to connected users having the "adminentreprise" role into the armadacar app and will only retrive users that are in the company of the caller, otherwise a HTTP 404 is returned.
DELETE /user/{id}
Rights : This endpoint is only available to connected users having the "adminentreprise" role into the armadacar app and will only delete users that are in the company of the caller. It is also accessible by users in entreprise-management-admin role with nos restrictions.
PUT /user/{id}
Rights : This endpoint is only available to connected users having the "adminentreprise" role into the armadacar app and will only delete users that are in the company of the caller. It is also accessible by users in entreprise-management-admin role with no restriction on any user, but it will always check that the user to modify is never moved from a company to a other.
Payload : Payload should be this format :
{
"email": "$email",
"first_name": "$last_name",
"last_name": "$last_name",
"id_entreprise": "$id_entreprise",
"adress": "$adress",
"ville": "$ville",
"code_postal": "$code_postal",
"phone": "$phone"
}
POST /user
Rights : This endpoint is only available to connected users having the "adminentreprise" role into the armadacar app and will only add users in the company of the caller. If a user is already in Keycloak with the same email, it will return a HTTP 409. It is also accessible by users in entreprise-management-admin role with no restriction on any user.
Payload : Payload should be this format :
{
"email": "$email",
"first_name": "$last_name",
"last_name": "$last_name",
"id_entreprise": "$id_entreprise",
"adress": "$adress",
"ville": "$ville",
"code_postal": "$code_postal",
"phone": "$phone"
}
👤 Startfleet
Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.
Give a ⭐️ if this project helped you!
This README was generated with ❤️ by readme-md-generator