@nebular/security
Advanced tools
Comparing version 5.1.0 to 6.0.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('tslib'), require('@angular/common'), require('rxjs/operators'), require('rxjs')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', 'tslib', '@angular/common', 'rxjs/operators', 'rxjs'], factory) : | ||
(factory((global.nb = global.nb || {}, global.nb.security = global.nb.security || {}),global.ng.core,global.tslib,global.ng.common,global.Rx.operators,global.Rx)); | ||
}(this, (function (exports,_angular_core,tslib,_angular_common,rxjs_operators,rxjs) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('rxjs/operators'), require('rxjs')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/common', 'rxjs/operators', 'rxjs'], factory) : | ||
(factory((global.nb = global.nb || {}, global.nb.security = global.nb.security || {}),global.ng.core,global.ng.common,global.Rx.operators,global.Rx)); | ||
}(this, (function (exports,_angular_core,_angular_common,rxjs_operators,rxjs) { 'use strict'; | ||
var NB_SECURITY_OPTIONS_TOKEN = new _angular_core.InjectionToken('Nebular Security Options'); | ||
const NB_SECURITY_OPTIONS_TOKEN = new _angular_core.InjectionToken('Nebular Security Options'); | ||
@@ -14,18 +14,17 @@ /** | ||
*/ | ||
var shallowObjectClone = function (o) { return Object.assign({}, o); }; | ||
var ɵ0 = shallowObjectClone; | ||
var shallowArrayClone = function (a) { return Object.assign([], a); }; | ||
var ɵ1 = shallowArrayClone; | ||
var popParent = function (abilities) { | ||
var parent = abilities['parent']; | ||
const shallowObjectClone = (o) => Object.assign({}, o); | ||
const ɵ0 = shallowObjectClone; | ||
const shallowArrayClone = (a) => Object.assign([], a); | ||
const ɵ1 = shallowArrayClone; | ||
const popParent = (abilities) => { | ||
const parent = abilities['parent']; | ||
delete abilities['parent']; | ||
return parent; | ||
}; | ||
var ɵ2 = popParent; | ||
const ɵ2 = popParent; | ||
/** | ||
* Common acl service. | ||
*/ | ||
var NbAclService = /** @class */ (function () { | ||
function NbAclService(settings) { | ||
if (settings === void 0) { settings = {}; } | ||
class NbAclService { | ||
constructor(settings = {}) { | ||
this.settings = settings; | ||
@@ -37,3 +36,2 @@ this.state = {}; | ||
} | ||
NbAclService_1 = NbAclService; | ||
/** | ||
@@ -43,10 +41,9 @@ * Set/Reset ACL list | ||
*/ | ||
NbAclService.prototype.setAccessControl = function (list) { | ||
for (var _i = 0, _a = Object.entries(list); _i < _a.length; _i++) { | ||
var _b = _a[_i], role = _b[0], value = _b[1]; | ||
var abilities = shallowObjectClone(value); | ||
var parent_1 = popParent(abilities); | ||
this.register(role, parent_1, abilities); | ||
setAccessControl(list) { | ||
for (const [role, value] of Object.entries(list)) { | ||
const abilities = shallowObjectClone(value); | ||
const parent = popParent(abilities); | ||
this.register(role, parent, abilities); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -58,5 +55,3 @@ * Register a new role with a list of abilities (permission/resources combinations) | ||
*/ | ||
NbAclService.prototype.register = function (role, parent, abilities) { | ||
if (parent === void 0) { parent = null; } | ||
if (abilities === void 0) { abilities = {}; } | ||
register(role, parent = null, abilities = {}) { | ||
this.validateRole(role); | ||
@@ -66,8 +61,7 @@ this.state[role] = { | ||
}; | ||
for (var _i = 0, _a = Object.entries(abilities); _i < _a.length; _i++) { | ||
var _b = _a[_i], permission = _b[0], value = _b[1]; | ||
var resources = typeof value === 'string' ? [value] : value; | ||
for (const [permission, value] of Object.entries(abilities)) { | ||
const resources = typeof value === 'string' ? [value] : value; | ||
this.allow(role, permission, shallowArrayClone(resources)); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -79,3 +73,3 @@ * Allow a permission for specific resources to a role | ||
*/ | ||
NbAclService.prototype.allow = function (role, permission, resource) { | ||
allow(role, permission, resource) { | ||
this.validateRole(role); | ||
@@ -86,7 +80,7 @@ if (!this.getRole(role)) { | ||
resource = typeof resource === 'string' ? [resource] : resource; | ||
var resources = shallowArrayClone(this.getRoleResources(role, permission)); | ||
let resources = shallowArrayClone(this.getRoleResources(role, permission)); | ||
resources = resources.concat(resource); | ||
this.state[role][permission] = resources | ||
.filter(function (item, pos) { return resources.indexOf(item) === pos; }); | ||
}; | ||
.filter((item, pos) => resources.indexOf(item) === pos); | ||
} | ||
/** | ||
@@ -99,52 +93,48 @@ * Check whether the role has a permission to a resource | ||
*/ | ||
NbAclService.prototype.can = function (role, permission, resource) { | ||
can(role, permission, resource) { | ||
this.validateResource(resource); | ||
var parentRole = this.getRoleParent(role); | ||
var parentCan = parentRole && this.can(this.getRoleParent(role), permission, resource); | ||
const parentRole = this.getRoleParent(role); | ||
const parentCan = parentRole && this.can(this.getRoleParent(role), permission, resource); | ||
return parentCan || this.exactCan(role, permission, resource); | ||
}; | ||
NbAclService.prototype.getRole = function (role) { | ||
} | ||
getRole(role) { | ||
return this.state[role]; | ||
}; | ||
NbAclService.prototype.validateRole = function (role) { | ||
} | ||
validateRole(role) { | ||
if (!role) { | ||
throw new Error('NbAclService: role name cannot be empty'); | ||
} | ||
}; | ||
NbAclService.prototype.validateResource = function (resource) { | ||
if (!resource || [NbAclService_1.ANY_RESOURCE].includes(resource)) { | ||
throw new Error("NbAclService: cannot use empty or bulk '*' resource placeholder with 'can' method"); | ||
} | ||
validateResource(resource) { | ||
if (!resource || [NbAclService.ANY_RESOURCE].includes(resource)) { | ||
throw new Error(`NbAclService: cannot use empty or bulk '*' resource placeholder with 'can' method`); | ||
} | ||
}; | ||
NbAclService.prototype.exactCan = function (role, permission, resource) { | ||
var resources = this.getRoleResources(role, permission); | ||
return resources.includes(resource) || resources.includes(NbAclService_1.ANY_RESOURCE); | ||
}; | ||
NbAclService.prototype.getRoleResources = function (role, permission) { | ||
} | ||
exactCan(role, permission, resource) { | ||
const resources = this.getRoleResources(role, permission); | ||
return resources.includes(resource) || resources.includes(NbAclService.ANY_RESOURCE); | ||
} | ||
getRoleResources(role, permission) { | ||
return this.getRoleAbilities(role)[permission] || []; | ||
}; | ||
NbAclService.prototype.getRoleAbilities = function (role) { | ||
var abilities = shallowObjectClone(this.state[role] || {}); | ||
} | ||
getRoleAbilities(role) { | ||
const abilities = shallowObjectClone(this.state[role] || {}); | ||
popParent(shallowObjectClone(this.state[role] || {})); | ||
return abilities; | ||
}; | ||
NbAclService.prototype.getRoleParent = function (role) { | ||
} | ||
getRoleParent(role) { | ||
return this.state[role] ? this.state[role]['parent'] : null; | ||
}; | ||
var NbAclService_1; | ||
NbAclService.ANY_RESOURCE = '*'; | ||
NbAclService = NbAclService_1 = tslib.__decorate([ | ||
_angular_core.Injectable(), | ||
tslib.__param(0, _angular_core.Optional()), tslib.__param(0, _angular_core.Inject(NB_SECURITY_OPTIONS_TOKEN)), | ||
tslib.__metadata("design:paramtypes", [Object]) | ||
], NbAclService); | ||
return NbAclService; | ||
}()); | ||
var NbRoleProvider = /** @class */ (function () { | ||
function NbRoleProvider() { | ||
} | ||
return NbRoleProvider; | ||
}()); | ||
} | ||
NbAclService.ANY_RESOURCE = '*'; | ||
NbAclService.decorators = [ | ||
{ type: _angular_core.Injectable } | ||
]; | ||
NbAclService.ctorParameters = () => [ | ||
{ type: undefined, decorators: [{ type: _angular_core.Optional }, { type: _angular_core.Inject, args: [NB_SECURITY_OPTIONS_TOKEN,] }] } | ||
]; | ||
class NbRoleProvider { | ||
} | ||
/** | ||
@@ -160,4 +150,4 @@ * @license | ||
*/ | ||
var NbAccessChecker = /** @class */ (function () { | ||
function NbAccessChecker(roleProvider, acl) { | ||
class NbAccessChecker { | ||
constructor(roleProvider, acl) { | ||
this.roleProvider = roleProvider; | ||
@@ -173,18 +163,19 @@ this.acl = acl; | ||
*/ | ||
NbAccessChecker.prototype.isGranted = function (permission, resource) { | ||
var _this = this; | ||
isGranted(permission, resource) { | ||
return this.roleProvider.getRole() | ||
.pipe(rxjs_operators.map(function (role) { return Array.isArray(role) ? role : [role]; }), rxjs_operators.map(function (roles) { | ||
return roles.some(function (role) { return _this.acl.can(role, permission, resource); }); | ||
.pipe(rxjs_operators.map((role) => Array.isArray(role) ? role : [role]), rxjs_operators.map((roles) => { | ||
return roles.some(role => this.acl.can(role, permission, resource)); | ||
})); | ||
}; | ||
NbAccessChecker = tslib.__decorate([ | ||
_angular_core.Injectable(), | ||
tslib.__metadata("design:paramtypes", [NbRoleProvider, NbAclService]) | ||
], NbAccessChecker); | ||
return NbAccessChecker; | ||
}()); | ||
} | ||
} | ||
NbAccessChecker.decorators = [ | ||
{ type: _angular_core.Injectable } | ||
]; | ||
NbAccessChecker.ctorParameters = () => [ | ||
{ type: NbRoleProvider }, | ||
{ type: NbAclService } | ||
]; | ||
var NbIsGrantedDirective = /** @class */ (function () { | ||
function NbIsGrantedDirective(templateRef, viewContainer, accessChecker) { | ||
class NbIsGrantedDirective { | ||
constructor(templateRef, viewContainer, accessChecker) { | ||
this.templateRef = templateRef; | ||
@@ -196,47 +187,37 @@ this.viewContainer = viewContainer; | ||
} | ||
Object.defineProperty(NbIsGrantedDirective.prototype, "nbIsGranted", { | ||
set: function (_a) { | ||
var _this = this; | ||
var permission = _a[0], resource = _a[1]; | ||
this.accessChecker.isGranted(permission, resource) | ||
.pipe(rxjs_operators.takeUntil(this.destroy$)) | ||
.subscribe(function (can) { | ||
if (can && !_this.hasView) { | ||
_this.viewContainer.createEmbeddedView(_this.templateRef); | ||
_this.hasView = true; | ||
} | ||
else if (!can && _this.hasView) { | ||
_this.viewContainer.clear(); | ||
_this.hasView = false; | ||
} | ||
}); | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
NbIsGrantedDirective.prototype.ngOnDestroy = function () { | ||
set nbIsGranted([permission, resource]) { | ||
this.accessChecker.isGranted(permission, resource) | ||
.pipe(rxjs_operators.takeUntil(this.destroy$)) | ||
.subscribe((can) => { | ||
if (can && !this.hasView) { | ||
this.viewContainer.createEmbeddedView(this.templateRef); | ||
this.hasView = true; | ||
} | ||
else if (!can && this.hasView) { | ||
this.viewContainer.clear(); | ||
this.hasView = false; | ||
} | ||
}); | ||
} | ||
ngOnDestroy() { | ||
this.destroy$.next(); | ||
this.destroy$.complete(); | ||
}; | ||
tslib.__decorate([ | ||
_angular_core.Input(), | ||
tslib.__metadata("design:type", Array), | ||
tslib.__metadata("design:paramtypes", [Array]) | ||
], NbIsGrantedDirective.prototype, "nbIsGranted", null); | ||
NbIsGrantedDirective = tslib.__decorate([ | ||
_angular_core.Directive({ selector: '[nbIsGranted]' }), | ||
tslib.__metadata("design:paramtypes", [_angular_core.TemplateRef, | ||
_angular_core.ViewContainerRef, | ||
NbAccessChecker]) | ||
], NbIsGrantedDirective); | ||
return NbIsGrantedDirective; | ||
}()); | ||
} | ||
} | ||
NbIsGrantedDirective.decorators = [ | ||
{ type: _angular_core.Directive, args: [{ selector: '[nbIsGranted]' },] } | ||
]; | ||
NbIsGrantedDirective.ctorParameters = () => [ | ||
{ type: _angular_core.TemplateRef }, | ||
{ type: _angular_core.ViewContainerRef }, | ||
{ type: NbAccessChecker } | ||
]; | ||
NbIsGrantedDirective.propDecorators = { | ||
nbIsGranted: [{ type: _angular_core.Input }] | ||
}; | ||
var NbSecurityModule = /** @class */ (function () { | ||
function NbSecurityModule() { | ||
} | ||
NbSecurityModule_1 = NbSecurityModule; | ||
NbSecurityModule.forRoot = function (nbSecurityOptions) { | ||
class NbSecurityModule { | ||
static forRoot(nbSecurityOptions) { | ||
return { | ||
ngModule: NbSecurityModule_1, | ||
ngModule: NbSecurityModule, | ||
providers: [ | ||
@@ -248,19 +229,17 @@ { provide: NB_SECURITY_OPTIONS_TOKEN, useValue: nbSecurityOptions }, | ||
}; | ||
}; | ||
var NbSecurityModule_1; | ||
NbSecurityModule = NbSecurityModule_1 = tslib.__decorate([ | ||
_angular_core.NgModule({ | ||
imports: [ | ||
_angular_common.CommonModule, | ||
], | ||
declarations: [ | ||
NbIsGrantedDirective, | ||
], | ||
exports: [ | ||
NbIsGrantedDirective, | ||
], | ||
}) | ||
], NbSecurityModule); | ||
return NbSecurityModule; | ||
}()); | ||
} | ||
} | ||
NbSecurityModule.decorators = [ | ||
{ type: _angular_core.NgModule, args: [{ | ||
imports: [ | ||
_angular_common.CommonModule, | ||
], | ||
declarations: [ | ||
NbIsGrantedDirective, | ||
], | ||
exports: [ | ||
NbIsGrantedDirective, | ||
], | ||
},] } | ||
]; | ||
@@ -267,0 +246,0 @@ /** |
@@ -1,2 +0,1 @@ | ||
import { __decorate, __metadata } from "tslib"; | ||
import { Directive, Input, TemplateRef, ViewContainerRef } from '@angular/core'; | ||
@@ -6,3 +5,3 @@ import { takeUntil } from 'rxjs/operators'; | ||
import { NbAccessChecker } from '../services/access-checker.service'; | ||
let NbIsGrantedDirective = class NbIsGrantedDirective { | ||
export class NbIsGrantedDirective { | ||
constructor(templateRef, viewContainer, accessChecker) { | ||
@@ -33,15 +32,14 @@ this.templateRef = templateRef; | ||
} | ||
} | ||
NbIsGrantedDirective.decorators = [ | ||
{ type: Directive, args: [{ selector: '[nbIsGranted]' },] } | ||
]; | ||
NbIsGrantedDirective.ctorParameters = () => [ | ||
{ type: TemplateRef }, | ||
{ type: ViewContainerRef }, | ||
{ type: NbAccessChecker } | ||
]; | ||
NbIsGrantedDirective.propDecorators = { | ||
nbIsGranted: [{ type: Input }] | ||
}; | ||
__decorate([ | ||
Input(), | ||
__metadata("design:type", Array), | ||
__metadata("design:paramtypes", [Array]) | ||
], NbIsGrantedDirective.prototype, "nbIsGranted", null); | ||
NbIsGrantedDirective = __decorate([ | ||
Directive({ selector: '[nbIsGranted]' }), | ||
__metadata("design:paramtypes", [TemplateRef, | ||
ViewContainerRef, | ||
NbAccessChecker]) | ||
], NbIsGrantedDirective); | ||
export { NbIsGrantedDirective }; | ||
//# sourceMappingURL=is-granted.directive.js.map |
@@ -1,3 +0,1 @@ | ||
var NbSecurityModule_1; | ||
import { __decorate } from "tslib"; | ||
import { NgModule } from '@angular/core'; | ||
@@ -9,6 +7,6 @@ import { CommonModule } from '@angular/common'; | ||
import { NbIsGrantedDirective } from './directives/is-granted.directive'; | ||
let NbSecurityModule = NbSecurityModule_1 = class NbSecurityModule { | ||
export class NbSecurityModule { | ||
static forRoot(nbSecurityOptions) { | ||
return { | ||
ngModule: NbSecurityModule_1, | ||
ngModule: NbSecurityModule, | ||
providers: [ | ||
@@ -21,17 +19,16 @@ { provide: NB_SECURITY_OPTIONS_TOKEN, useValue: nbSecurityOptions }, | ||
} | ||
}; | ||
NbSecurityModule = NbSecurityModule_1 = __decorate([ | ||
NgModule({ | ||
imports: [ | ||
CommonModule, | ||
], | ||
declarations: [ | ||
NbIsGrantedDirective, | ||
], | ||
exports: [ | ||
NbIsGrantedDirective, | ||
], | ||
}) | ||
], NbSecurityModule); | ||
export { NbSecurityModule }; | ||
} | ||
NbSecurityModule.decorators = [ | ||
{ type: NgModule, args: [{ | ||
imports: [ | ||
CommonModule, | ||
], | ||
declarations: [ | ||
NbIsGrantedDirective, | ||
], | ||
exports: [ | ||
NbIsGrantedDirective, | ||
], | ||
},] } | ||
]; | ||
//# sourceMappingURL=security.module.js.map |
@@ -1,2 +0,1 @@ | ||
import { __decorate, __metadata } from "tslib"; | ||
/** | ||
@@ -16,3 +15,3 @@ * @license | ||
*/ | ||
let NbAccessChecker = class NbAccessChecker { | ||
export class NbAccessChecker { | ||
constructor(roleProvider, acl) { | ||
@@ -35,8 +34,10 @@ this.roleProvider = roleProvider; | ||
} | ||
}; | ||
NbAccessChecker = __decorate([ | ||
Injectable(), | ||
__metadata("design:paramtypes", [NbRoleProvider, NbAclService]) | ||
], NbAccessChecker); | ||
export { NbAccessChecker }; | ||
} | ||
NbAccessChecker.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
NbAccessChecker.ctorParameters = () => [ | ||
{ type: NbRoleProvider }, | ||
{ type: NbAclService } | ||
]; | ||
//# sourceMappingURL=access-checker.service.js.map |
@@ -1,3 +0,1 @@ | ||
var NbAclService_1; | ||
import { __decorate, __metadata, __param } from "tslib"; | ||
/** | ||
@@ -23,3 +21,3 @@ * @license | ||
*/ | ||
let NbAclService = NbAclService_1 = class NbAclService { | ||
export class NbAclService { | ||
constructor(settings = {}) { | ||
@@ -98,3 +96,3 @@ this.settings = settings; | ||
validateResource(resource) { | ||
if (!resource || [NbAclService_1.ANY_RESOURCE].includes(resource)) { | ||
if (!resource || [NbAclService.ANY_RESOURCE].includes(resource)) { | ||
throw new Error(`NbAclService: cannot use empty or bulk '*' resource placeholder with 'can' method`); | ||
@@ -105,3 +103,3 @@ } | ||
const resources = this.getRoleResources(role, permission); | ||
return resources.includes(resource) || resources.includes(NbAclService_1.ANY_RESOURCE); | ||
return resources.includes(resource) || resources.includes(NbAclService.ANY_RESOURCE); | ||
} | ||
@@ -119,11 +117,11 @@ getRoleResources(role, permission) { | ||
} | ||
}; | ||
} | ||
NbAclService.ANY_RESOURCE = '*'; | ||
NbAclService = NbAclService_1 = __decorate([ | ||
Injectable(), | ||
__param(0, Optional()), __param(0, Inject(NB_SECURITY_OPTIONS_TOKEN)), | ||
__metadata("design:paramtypes", [Object]) | ||
], NbAclService); | ||
export { NbAclService }; | ||
NbAclService.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
NbAclService.ctorParameters = () => [ | ||
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [NB_SECURITY_OPTIONS_TOKEN,] }] } | ||
]; | ||
export { ɵ0, ɵ1, ɵ2 }; | ||
//# sourceMappingURL=acl.service.js.map |
import { Directive, Inject, Injectable, InjectionToken, Input, NgModule, Optional, TemplateRef, ViewContainerRef } from '@angular/core'; | ||
import { __decorate, __metadata, __param } from 'tslib'; | ||
import { CommonModule } from '@angular/common'; | ||
@@ -9,3 +8,2 @@ import { map, takeUntil } from 'rxjs/operators'; | ||
var NbAclService_1; | ||
/** | ||
@@ -29,3 +27,3 @@ * @license | ||
*/ | ||
let NbAclService = NbAclService_1 = class NbAclService { | ||
class NbAclService { | ||
constructor(settings = {}) { | ||
@@ -104,3 +102,3 @@ this.settings = settings; | ||
validateResource(resource) { | ||
if (!resource || [NbAclService_1.ANY_RESOURCE].includes(resource)) { | ||
if (!resource || [NbAclService.ANY_RESOURCE].includes(resource)) { | ||
throw new Error(`NbAclService: cannot use empty or bulk '*' resource placeholder with 'can' method`); | ||
@@ -111,3 +109,3 @@ } | ||
const resources = this.getRoleResources(role, permission); | ||
return resources.includes(resource) || resources.includes(NbAclService_1.ANY_RESOURCE); | ||
return resources.includes(resource) || resources.includes(NbAclService.ANY_RESOURCE); | ||
} | ||
@@ -125,9 +123,10 @@ getRoleResources(role, permission) { | ||
} | ||
}; | ||
} | ||
NbAclService.ANY_RESOURCE = '*'; | ||
NbAclService = NbAclService_1 = __decorate([ | ||
Injectable(), | ||
__param(0, Optional()), __param(0, Inject(NB_SECURITY_OPTIONS_TOKEN)), | ||
__metadata("design:paramtypes", [Object]) | ||
], NbAclService); | ||
NbAclService.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
NbAclService.ctorParameters = () => [ | ||
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [NB_SECURITY_OPTIONS_TOKEN,] }] } | ||
]; | ||
@@ -147,3 +146,3 @@ class NbRoleProvider { | ||
*/ | ||
let NbAccessChecker = class NbAccessChecker { | ||
class NbAccessChecker { | ||
constructor(roleProvider, acl) { | ||
@@ -166,9 +165,12 @@ this.roleProvider = roleProvider; | ||
} | ||
}; | ||
NbAccessChecker = __decorate([ | ||
Injectable(), | ||
__metadata("design:paramtypes", [NbRoleProvider, NbAclService]) | ||
], NbAccessChecker); | ||
} | ||
NbAccessChecker.decorators = [ | ||
{ type: Injectable } | ||
]; | ||
NbAccessChecker.ctorParameters = () => [ | ||
{ type: NbRoleProvider }, | ||
{ type: NbAclService } | ||
]; | ||
let NbIsGrantedDirective = class NbIsGrantedDirective { | ||
class NbIsGrantedDirective { | ||
constructor(templateRef, viewContainer, accessChecker) { | ||
@@ -199,20 +201,19 @@ this.templateRef = templateRef; | ||
} | ||
} | ||
NbIsGrantedDirective.decorators = [ | ||
{ type: Directive, args: [{ selector: '[nbIsGranted]' },] } | ||
]; | ||
NbIsGrantedDirective.ctorParameters = () => [ | ||
{ type: TemplateRef }, | ||
{ type: ViewContainerRef }, | ||
{ type: NbAccessChecker } | ||
]; | ||
NbIsGrantedDirective.propDecorators = { | ||
nbIsGranted: [{ type: Input }] | ||
}; | ||
__decorate([ | ||
Input(), | ||
__metadata("design:type", Array), | ||
__metadata("design:paramtypes", [Array]) | ||
], NbIsGrantedDirective.prototype, "nbIsGranted", null); | ||
NbIsGrantedDirective = __decorate([ | ||
Directive({ selector: '[nbIsGranted]' }), | ||
__metadata("design:paramtypes", [TemplateRef, | ||
ViewContainerRef, | ||
NbAccessChecker]) | ||
], NbIsGrantedDirective); | ||
var NbSecurityModule_1; | ||
let NbSecurityModule = NbSecurityModule_1 = class NbSecurityModule { | ||
class NbSecurityModule { | ||
static forRoot(nbSecurityOptions) { | ||
return { | ||
ngModule: NbSecurityModule_1, | ||
ngModule: NbSecurityModule, | ||
providers: [ | ||
@@ -225,16 +226,16 @@ { provide: NB_SECURITY_OPTIONS_TOKEN, useValue: nbSecurityOptions }, | ||
} | ||
}; | ||
NbSecurityModule = NbSecurityModule_1 = __decorate([ | ||
NgModule({ | ||
imports: [ | ||
CommonModule, | ||
], | ||
declarations: [ | ||
NbIsGrantedDirective, | ||
], | ||
exports: [ | ||
NbIsGrantedDirective, | ||
], | ||
}) | ||
], NbSecurityModule); | ||
} | ||
NbSecurityModule.decorators = [ | ||
{ type: NgModule, args: [{ | ||
imports: [ | ||
CommonModule, | ||
], | ||
declarations: [ | ||
NbIsGrantedDirective, | ||
], | ||
exports: [ | ||
NbIsGrantedDirective, | ||
], | ||
},] } | ||
]; | ||
@@ -241,0 +242,0 @@ /** |
{ | ||
"name": "@nebular/security", | ||
"version": "5.1.0", | ||
"version": "6.0.0", | ||
"description": "@nebular/security", | ||
@@ -29,15 +29,13 @@ "author": "akveo", | ||
"peerDependencies": { | ||
"@angular/common": "^9.0.0", | ||
"@angular/core": "^9.0.0", | ||
"@angular/router": "^9.0.0", | ||
"@angular/common": "^10.0.0", | ||
"@angular/core": "^10.0.0", | ||
"@angular/router": "^10.0.0", | ||
"rxjs": "^6.5.4", | ||
"tslib": "^1.9.0" | ||
"tslib": "^2.0.0" | ||
}, | ||
"sideEffects": false, | ||
"main": "bundles/security.umd.js", | ||
"module": "fesm5/index.js", | ||
"module": "fesm2015/index.js", | ||
"es2015": "fesm2015/index.js", | ||
"esm5": "esm5/index.js", | ||
"esm2015": "esm2015/index.js", | ||
"fesm5": "fesm5/index.js", | ||
"fesm2015": "fesm2015/index.js", | ||
@@ -44,0 +42,0 @@ "typings": "index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
52467
30
857