feat(*/README.md): re-generate for all packages
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
<!-- DO NOT EDIT MANUALLY, THIS FILE HAS BEEN GENERATED -->
|
||||
|
||||
# xo-acl-resolver [](https://travis-ci.org/vatesfr/xen-orchestra)
|
||||
|
||||
> [Xen-Orchestra](http://xen-orchestra.com/) internal: do ACLs resolution.
|
||||
[](https://npmjs.org/package/xo-acl-resolver)  [](https://packagephobia.now.sh/result?p=xo-acl-resolver)
|
||||
|
||||
> Xen-Orchestra internal: do ACLs resolution
|
||||
|
||||
## Install
|
||||
|
||||
@@ -42,28 +46,6 @@ if (
|
||||
}
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Installing dependencies
|
||||
|
||||
```
|
||||
> npm install
|
||||
```
|
||||
|
||||
### Compilation
|
||||
|
||||
The sources files are watched and automatically recompiled on changes.
|
||||
|
||||
```
|
||||
> npm run dev
|
||||
```
|
||||
|
||||
### Tests
|
||||
|
||||
```
|
||||
> npm run test-dev
|
||||
```
|
||||
|
||||
## Contributions
|
||||
|
||||
Contributions are _very_ welcomed, either on the documentation or on
|
||||
@@ -77,4 +59,4 @@ You may:
|
||||
|
||||
## License
|
||||
|
||||
ISC © [Vates SAS](https://vates.fr)
|
||||
[AGPL-3.0-or-later](hhttps://spdx.org/licenses/AGPL-3.0-or-later) © [Vates SAS](https://vates.fr)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
```js
|
||||
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')
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user