text: var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
      var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
      if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
      else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
      return c > 3 && r && Object.defineProperty(target, key, r), r;
  };
  var __metadata = (this && this.__metadata) || function (k, v) {
      if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
  };
  /**
   * @license
   * Copyright Akveo. All Rights Reserved.
   * Licensed under the MIT License. See License.txt in the project root for license information.
   */
  import { Injectable } from '@angular/core';
  import { NbRoleProvider } from './role.provider';
  import { NbAclService } from './acl.service';
  import { map } from 'rxjs/operators';
  /**
   * Access checker service.
   *
   * Injects `NbRoleProvider` to determine current user role, and checks access permissions using `NbAclService`
   */
  var NbAccessChecker = /** @class */ (function () {
      function NbAccessChecker(roleProvider, acl) {
          this.roleProvider = roleProvider;
          this.acl = acl;
      }
      /**
       * Checks whether access is granted or not
       *
       * @param {string} permission
       * @param {string} resource
       * @returns {Observable<boolean>}
       */
      NbAccessChecker.prototype.isGranted = function (permission, resource) {
          var _this = this;
          return this.roleProvider.getRole()
              .pipe(map(function (role) { return Array.isArray(role) ? role : [role]; }), map(function (roles) {
              return roles.some(function (role) { return _this.acl.can(role, permission, resource); });
          }));
      };
      NbAccessChecker = __decorate([
          Injectable(),
          __metadata("design:paramtypes", [NbRoleProvider, NbAclService])
      ], NbAccessChecker);
      return NbAccessChecker;
  }());
  export { NbAccessChecker };
  //# sourceMappingURL=access-checker.service.js.map