kaneoh-access-control
v0.0.13
Published
Kaneoh Access Control
Downloads
4
Readme
Kaneoh Access Control
Access Control for data in whole collection and per object
Config Example
const collections = [
{
name: "products",
idField: "_id",
mongo: db.getCollection("products"),
rules: {
read: [
{
selector: {
stakeholders: {
$elemMatch: {
id: "_userId_",
role: "kaneoh",
},
},
},
},
],
update: [
{
selector: {
"ownerId": "_userId_",
},
},
],
},
},
{
name: "projects",
idField: "_id",
mongo: db.getCollection("projects"),
rules: {
read: [
{
collectionName: "products",
selector: {
"stakeholders.id": "_userId_",
},
},
],
update: [
{
selector: {
"ownerId": "_userId_",
},
},
],
},
parents: [
{
name: "products",
localField: "productId",
},
],
},
{
name: "defects",
idField: "_id",
mongo: db.getCollection("projects"),
rules: {
read: [
{
collectionName: "projects",
selector: {
"stakeholders.id": "_userId_",
},
},
{
collectionName: "products",
selector: {
"stakeholders.id": "_userId_",
},
},
],
update: [
{
selector: {
"submitter": "_userId_",
},
},
],
},
parents: [
{
name: "products",
localField: "productId",
},
],
},
];
const kAC = KAC.getInstance();
kAC.setup((user : Meteor.User) => {return false;}, aclCollection, collections);