arbojs v0.0.28
ArboJS
A short documentation on using ArboJS.
Introduction
ArboJS
Modules
ArboJS is built of modules
Base
This module defines some base methods to be shared by every other module implemented:
.setup(conn).uninstall(conn).ensurePermission(conn, userId, sectionId, permissionsIds).searchDeep(conn, userId, offset, limit).checkCRUDPermission(req, res, next, target)
Additionally, ArboJS can also create REST endpoints automatically for every module implemented, creating POST, GET, PUT and DELETE routes.
Example: a module named
Userwill have the routes:
POST: /User/GET: /User/:idPUT: /User/DELETE: /User/:id
Crypto Utils
Contains some helper functions using Node's crypto package:
hash(salt, msg, enc = 'base64')Hashes a
msgusing the givensaltand returns the resulting hash encoded using the optional parameterenc(if not sent, will default to base64 encoding).randomString(len)Returns a random (safe) string with
lencharacters.
Permission
Module that controls permissions accross the application. This module defines the following tables:
Permission
A table that only lists existing permissions on the application, but doesn't grant them. Examples:
'read User','search Role','delete Permission'.Role
A table that lists existing roles on the application. Examples:
User,Admin,Guest.RolePermission
A table with the columns
role_idandpermission_idthat connects thePermissionandRoletables by their entries IDs. Example: An entry{ role_id: 1, permission_id: 4 }means that theRolewithid = 1will be granted thePermissionwithid = 4.PermissionCache
A "cache table" with the columns
user_id,permission_id,section_id,permission,membership_id,membership_role_id,role_idandrole_permission_idthat puts all the relevant information to permissions together.
Section
Module that controls the sections and memberships of users across the application. This module defines the following tables:
Section
A table that defines different sections of the application. (Users can have different permissions on different sections).
Membership
A table to store the membership of users on each section and the status of the membership.
MembershipRole
A table that links a membership to a role by their IDs.
User
The user module, that controls registrations, authentication and other user-related functionalities. This module defines the following tables:
User
The basic entry of an user. Has the columns
login,email,password,saltandstatus.Token
A table to store the authentication token of users. These tokens are used to identify the user making requests and must be sent on all requests that require authentication/permission to access.
Var
An auxiliary module that defines useful variables of the system. This modules defines the table Var, that stores these variables.
1 year ago
2 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago