xen-orchestra/packages/xo-acl-resolver
Julien Fontanet 2a70ebf667 docs: uniformize code blocks
- add missing syntaxes
- don't put prompt if no command outputs to ease copy/paste and use `sh` syntax
- always use `$` as prompt and use `console` syntax
2023-02-06 11:25:12 +01:00
..
.npmignore feat: unified .npmignore for all packages 2021-04-07 13:58:14 +02:00
.USAGE.md chore: hide USAGE.md 2022-02-18 17:11:52 +01:00
index.js chore: format with Prettier 2021-06-03 14:49:14 +02:00
package.json feat: technical release (#6165) 2022-03-30 16:06:06 +02:00
README.md docs: uniformize code blocks 2023-02-06 11:25:12 +01:00

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