@rugo-vn/shared
v1.0.0
Published
Shared modules between Rugo's services.
Downloads
3
Readme
Rugo Shared
Shared modules between Rugo's services.
Permission
Allow handle policies and permissions.
Concept
Some part of Rugo Platform requires user's permissions to access. We call user's permissions is perms
.
When you travel across some services, you receive an identity field into an object called passport
.
At the end of the service (or action) you want to access, a security gate will check your passport
and decide that you can access or not.
perms
Each user after authentication will take their permissions from data storage. Format:
const perms = [
{
rule: 'value',
},
];
When value
can be:
- specific value.
- wildcard value
*
.
passport
After check your permissions with infomation data, you will receive:
const passport = {
rule: 'widest value range',
};
Your passport
is your first matched permission in perm
which remove checked rules.
E.g.
const passport = {
rowId: { $in: ['441', '223'] },
userId: '789',
};
Secure
You can use method in secure to do cryptography.
secure.encrypt
secure.decrypt
secure.hash
secure.hashPassword
secure.comparePassword