@brainhubeu/react-permissible
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "@brainhubeu/react-permissible", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Permission management component for React", | ||
@@ -22,3 +22,4 @@ "engines": { | ||
"dependencies": { | ||
"is-subset": "^0.1.1" | ||
"lodash.difference": "^4.5.0", | ||
"lodash.intersection": "^4.4.0" | ||
}, | ||
@@ -65,3 +66,2 @@ "devDependencies": { | ||
"json-loader": "^0.5.4", | ||
"lodash": "^4.17.4", | ||
"mocha": "^3.4.2", | ||
@@ -68,0 +68,0 @@ "node-sass": "^4.5.3", |
@@ -228,3 +228,15 @@ # react-permissible | ||
## 🍻 | ||
* [@adam-golab](https://github.com/adam-golab) & [@Lukasz-pluszczewski](https://github.com/Lukasz-pluszczewski/) for help | ||
* for help [@adam-golab](https://github.com/adam-golab) & [@Lukasz-pluszczewski](https://github.com/Lukasz-pluszczewski/) | ||
* [Nocny Kochanek](https://nocnykochanek.pl/) band for power | ||
## License | ||
React-permissible is copyright © 2014-2017 [Brainhub](https://brainhub.eu/) It is free software, and may be redistributed under the terms specified in the [license](LICENSE.md). | ||
## About | ||
React-permissible is maintained by [@kkoscielniak](https://github.com/kkoscielniak) & [@adam-golab](https://github.com/adam-golab) & [@Lukasz-pluszczewski](https://github.com/Lukasz-pluszczewski/) and the Brainhub development team. It is funded by Brainhub and the names and logos for Brainhub are trademarks of Brainhub Sp. z o.o.. You can check other open-source projects supported/developed by our teammates here. | ||
[![Brainhub](https://avatars0.githubusercontent.com/u/20307185?s=200&v=4)](https://brainhub.eu/?utm_source=github) | ||
We love open-source JavaScript software! See our other projects or hire us to build your next web, desktop and mobile application with JavaScript. |
import React, { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import intersection from 'lodash/intersection'; | ||
import isSubset from 'is-subset'; | ||
import intersection from 'lodash.intersection'; | ||
import difference from 'lodash.difference'; | ||
@@ -15,3 +15,3 @@ export function Permissible( | ||
? intersection(userPermissions, requiredPermissions).length | ||
: isSubset(userPermissions, requiredPermissions); | ||
: (!requiredPermissions.length || difference(requiredPermissions, userPermissions).length === 0); | ||
@@ -18,0 +18,0 @@ class PermissibleHOC extends Component { |
import { Component } from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import intersection from 'lodash/intersection'; | ||
import isSubset from 'is-subset'; | ||
import intersection from 'lodash.intersection'; | ||
import difference from 'lodash.difference'; | ||
@@ -21,3 +21,4 @@ export class PermissibleRender extends Component { | ||
} | ||
return isSubset(userPermissions, requiredPermissions); | ||
return !requiredPermissions.length | ||
|| difference(requiredPermissions, userPermissions).length === 0; | ||
} | ||
@@ -24,0 +25,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82176
64
58
1396
242
4
+ Addedlodash.difference@^4.5.0
+ Addedlodash.intersection@^4.4.0
+ Addedlodash.difference@4.5.0(transitive)
+ Addedlodash.intersection@4.4.0(transitive)
- Removedis-subset@^0.1.1
- Removedis-subset@0.1.1(transitive)