Lab μ infomation management system based on ldap
-
Install a ldap server, for example osixia/openldap .
-
Set proper environment variables. You can write them in secret.env which has been ignored by .gitignore.
-
Run
npm install --no-optional
to install dependencies. Option--no-optional
is required since one of bunyan's optional dependency will produce error, which prevent debugging. -
Run
gulp
for compiling. -
Run
node dist/index.js
and the server is listening at127.0.0.1:3000
.
Authenticate a user crendential.
field | type | description | required |
---|---|---|---|
uid | String | username | true |
password | String | password | true |
Response:
- 403: if wrong credential
- 200: if correct crendential
Logout.
Response:
- 403: if not logged in
- 200: logout successfully
Get information of a user
parameter | description | required |
---|---|---|
uid | username | true |
Response:
- 403: if not logged in.
- 200: user information as json
field | type | description |
---|---|---|
uid | String | username |
name | String | user's name |
groups | Array | groups user belongs to |
Update information of a user
parameter | description | required |
---|---|---|
uid | username | true |
field | type | description | required |
---|---|---|---|
name | String | user's name | false |
Response:
- 403: if has no permission.
- 200: if update succeed, returns updated user information
- 304: if field name missing.
Delete a user
Response:
- 403: if not in admin group.
- 200: array of all users.
Get user list
Response:
- 403: if not logged in.
- 200: array of all users.
Add a user
field | type | description | required |
---|---|---|---|
uid | String | username | true |
name | String | user's name | true |
password | String | password | true |
Response:
- 403: if not in admin group. or username already exists.
- 200: information of added user.