0.5.0 • Published 1 month ago

xo-acl-resolver v0.5.0

Weekly downloads
7
License
AGPL-3.0-or-later
Repository
github
Last release
1 month ago

xo-acl-resolver

Package Version License PackagePhobia Node compatibility

Xen-Orchestra internal: do ACLs resolution

Install

Installation of the npm package:

npm install --save xo-acl-resolver

Usage

import check from 'xo-acl-resolver'

// This object contains a list of permissions returned from
// xo-server's acl.getCurrentPermissions.
const permissions = {
  /* ... */
}

// This function should returns synchronously an object from an id.
const getObject = id => {
  /* ... */
}

// For a single object:
if (check(permissions, getObject, objectId, permission)) {
  console.log(`${permission} set for object ${objectId}`)
}

// For multiple objects/permissions:
if (
  check(permissions, getObject, [
    [object1Id, permission1],
    [object12d, permission2],
  ])
) {
  console.log('all permissions checked')
}

Contributions

Contributions are very welcomed, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

AGPL-3.0-or-later © Vates SAS

0.5.0

1 month ago

0.4.1

5 years ago

0.4.0

5 years ago

0.3.0

6 years ago

0.2.4

6 years ago

0.2.3

7 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.0

8 years ago

0.0.0-0

8 years ago