0.0.13 • Published 6 years ago

kaneoh-access-control v0.0.13

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

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);
0.0.13

6 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago