Files
xen-orchestra/packages/xo-acl-resolver/README.md
T

63 lines
1.6 KiB
Markdown
Raw Normal View History

<!-- DO NOT EDIT MANUALLY, THIS FILE HAS BEEN GENERATED -->
2020-06-01 14:41:52 +02:00
# xo-acl-resolver
2016-02-03 10:02:39 +01:00
2020-06-01 14:41:52 +02:00
[![Package Version](https://badgen.net/npm/v/xo-acl-resolver)](https://npmjs.org/package/xo-acl-resolver) ![License](https://badgen.net/npm/license/xo-acl-resolver) [![PackagePhobia](https://badgen.net/bundlephobia/minzip/xo-acl-resolver)](https://bundlephobia.com/result?p=xo-acl-resolver) [![Node compatibility](https://badgen.net/npm/node/xo-acl-resolver)](https://npmjs.org/package/xo-acl-resolver)
> Xen-Orchestra internal: do ACLs resolution
2016-02-03 10:02:39 +01:00
## Install
Installation of the [npm package](https://npmjs.org/package/xo-acl-resolver):
```
> npm install --save xo-acl-resolver
```
## Usage
2016-06-07 16:27:05 +02:00
```js
import check from 'xo-acl-resolver'
// This object contains a list of permissions returned from
// xo-server's acl.getCurrentPermissions.
2019-12-04 17:18:47 +01:00
const permissions = {
/* ... */
}
2016-06-07 16:27:05 +02:00
// This function should returns synchronously an object from an id.
2019-12-04 17:18:47 +01:00
const getObject = id => {
/* ... */
}
2016-06-07 16:27:05 +02:00
// For a single object:
if (check(permissions, getObject, objectId, permission)) {
console.log(`${permission} set for object ${objectId}`)
}
// For multiple objects/permissions:
2019-12-04 17:18:47 +01:00
if (
check(permissions, getObject, [
[object1Id, permission1],
[object12d, permission2],
])
) {
2016-06-07 16:27:05 +02:00
console.log('all permissions checked')
}
```
2016-02-03 10:02:39 +01:00
## Contributions
2019-12-04 17:18:47 +01:00
Contributions are _very_ welcomed, either on the documentation or on
2016-02-03 10:02:39 +01:00
the code.
You may:
2018-02-07 10:40:09 +01:00
- report any [issue](https://github.com/vatesfr/xen-orchestra/issues)
2016-02-03 10:02:39 +01:00
you've encountered;
- fork and create a pull request.
## License
2020-05-28 21:24:20 +02:00
[AGPL-3.0-or-later](https://spdx.org/licenses/AGPL-3.0-or-later) © [Vates SAS](https://vates.fr)