The system manages documents, users and user roles. Each document defines access rights; the document defines which roles can access it. Also, each document specifies the date it was published.
Users are categorized by roles. Each user must have a role defined for them.
Create a new user
POST - http://dms-api.herokuapp.com/api/v0.1/users
Post data
{
username: 'username',
email: 'example@host.com'
name: {
last: 'lastname',
first: 'firstname'
}
password: 'password',
role: 'dummy role' // Role has to be created before assignation.
}
Create a new document
Documnent is created by an existing and authenticated user.
POST - http://dms-api.herokuapp.com/api/v0.1/users
Post data
{
title: 'Documnent title',
content: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
}
Create a new role - Superadmin operation
Role is created by an Authorized and Authenticated user (superadmin).
POST - http://dms-api.herokuapp.com/api/v0.1/users
Post data
{
title: 'Trainer'
}
This project was setup with the intention of creating a secure platform where documents created remain confidential to their owners and featured owners. It is still in its initial stage. I do hope that it will gain maximum usage and recognition later on as I and other interested folks continue to work on it. 😁
Note: You need to have the following installed.
- MongoDB - Download here
- NodeJS - Download here
Then, clone the repository and run the npm install
command in the same directory.
API endpoints currently supported.
Users
Request type | Endpoint | Action | Privilege |
---|---|---|---|
POST | /api/v0.1/users | Create a new user | Anyone |
GET | /api/v0.1/users | Get all users | Superadmin and Admin |
GET | /api/v0.1/users:id | Get a specific user | Authenticated user |
PUT | /api/v0.1/users/:id | Update user information | Authenticated and Authorized user |
DELETE | /api/v0.1/users/:id | Remove a user from storage | Superadmin |
User Image Upload
Request type | Endpoint | Action | Privilege |
---|---|---|---|
POST | /api/v0.1/image/upload | Upload or change users' profile picture | Authenticated user |
DELETE | /api/v0.1/images/:id | Remove profile picture | Authenticated user |
Documents
Request type | Endpoint | Action | Privilege |
---|---|---|---|
POST | /api/v0.1/documents | Create a new document | Authenticated user |
GET | /api/v0.1/documents | Retrieve all documents | Superadmin and Admin |
GET | /api/v0.1/documents/:id | Retrieve a specific document | Documnent Owner |
GET | /api/v0.1/users/:id/documents | Retrieve all documents created by a user | Documnent Owner |
GET | /api/v0.1/roles/:id/documents | Retrieve all documents with a specific role | User with specified role |
PUT | /api/v0.1/documents/:id | Update a specific document | Documnent Owner |
DELETE | /api/v0.1/documents/:id | Remove a specific document from storage | Documnent Owner |
Roles
Request type | Endpoint | Action | Privilege |
---|---|---|---|
POST | /api/v0.1/roles | Create a new role | Superadmin |
GET | /api/v0.1/roles | Retrieve all roles | Superadmin and Admin |
GET | /api/v0.1/roles/:id | Retrieve a specific role | Superadmin and Admin |
PUT | /api/v0.1/roles/:id | Change a role name | Superadmin |
DELETE | /api/v0.1/roles/:id | Remove a specific role form storage | Superadmin |
After installation, run the npm test
command to run all tests.
- Test frameworks - Mocha and supertest
- Assertion library - Expect.js
- Test coverage tool/service - Coveralls
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request 👍
😎😎