diff --git a/npm/ng-packs/packages/core/src/lib/services/permission.service.ts b/npm/ng-packs/packages/core/src/lib/services/permission.service.ts index c549c5a7a85..af6a8e3d461 100644 --- a/npm/ng-packs/packages/core/src/lib/services/permission.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/permission.service.ts @@ -19,6 +19,17 @@ export class PermissionService { return this.isPolicyGranted(key, policies); } + filterGrantedPolicies(policyKeys: Array) { + const policies = this.getSnapshot(); + return policyKeys.filter(key => this.isPolicyGranted(key, policies)); + } + + filterGrantedPolicies$(policyKeys: Array) { + return this.getStream().pipe( + map(policies => policyKeys.filter(key => this.isPolicyGranted(key, policies))), + ); + } + protected isPolicyGranted(key: string, grantedPolicies: Record) { if (!key) return true;