From d148ad8af32c4a2f167d52e6cdb78140678ba20e Mon Sep 17 00:00:00 2001 From: Chihab Otmani Date: Sat, 3 Apr 2021 12:10:13 +0100 Subject: [PATCH 1/7] chore: add VerSem script --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 78a10b5..9153a90 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "build": "ng build --prod core", "test": "ng test core --watch=false --browsers=ChromeHeadless", "test:watch": "ng test core --browsers=ChromeHeadless", - "build:demo": "ng build --prod ngx-access" + "build:demo": "ng build --prod ngx-access", + "versem": "node ../versem/packages/cli/dist/index.js apply -t 8.0.x" }, "private": true, "dependencies": { From b2d446eaa73429bc4d305311f49fca51e6e63a82 Mon Sep 17 00:00:00 2001 From: Chihab Otmani Date: Sat, 3 Apr 2021 16:37:02 +0100 Subject: [PATCH 2/7] chore: remove angular.json top comment --- tsconfig.json | 1 - 1 file changed, 1 deletion(-) diff --git a/tsconfig.json b/tsconfig.json index 7777ac5..ae78bca 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,3 @@ -/* To learn more about this file see: https://angular.io/config/tsconfig. */ { "compileOnSave": false, "compilerOptions": { From 267276f02890c96a487b64b4e2c1dbe1b261ed5e Mon Sep 17 00:00:00 2001 From: Chihab Otmani Date: Sat, 3 Apr 2021 16:57:36 +0100 Subject: [PATCH 3/7] chore: remove budgets entry from angular.json --- angular.json | 5 ----- 1 file changed, 5 deletions(-) diff --git a/angular.json b/angular.json index 42197ea..a74856f 100644 --- a/angular.json +++ b/angular.json @@ -50,11 +50,6 @@ "type": "initial", "maximumWarning": "500kb", "maximumError": "1mb" - }, - { - "type": "anyComponentStyle", - "maximumWarning": "2kb", - "maximumError": "4kb" } ] } From 722c65204982355a5250f82f03b98e87c1b16929 Mon Sep 17 00:00:00 2001 From: Chihab Otmani Date: Sat, 3 Apr 2021 18:05:32 +0100 Subject: [PATCH 4/7] refactor: fix module import --- projects/core/src/lib/directives/access.directive.spec.ts | 2 +- src/app/app.component.ts | 2 +- src/app/app.module.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/projects/core/src/lib/directives/access.directive.spec.ts b/projects/core/src/lib/directives/access.directive.spec.ts index 931c8ff..fd06152 100644 --- a/projects/core/src/lib/directives/access.directive.spec.ts +++ b/projects/core/src/lib/directives/access.directive.spec.ts @@ -2,7 +2,7 @@ import { Observable, of } from 'rxjs'; import { Component } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { AccessModule } from '../../public-api'; +import { AccessModule } from '../core.module'; import { AccessStrategy } from '../services/access-strategy.service'; @Component({ diff --git a/src/app/app.component.ts b/src/app/app.component.ts index fd29990..df4a84f 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -1,5 +1,5 @@ import { Component, OnInit } from '@angular/core'; -import { AccessService, AccessStrategy } from 'projects/core/src/public-api'; +import { AccessService, AccessStrategy } from 'ngx-access'; @Component({ selector: 'app-root', diff --git a/src/app/app.module.ts b/src/app/app.module.ts index c7bb4b4..787889a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -6,11 +6,11 @@ import { AccessConfiguration, AccessGuard, AccessModule, + AccessService, AccessStrategy, } from 'ngx-access'; -import { AccessService } from 'projects/core/src/public-api'; import { of } from 'rxjs'; -import { catchError, tap } from 'rxjs/operators'; +import { catchError } from 'rxjs/operators'; import { AppComponent } from './app.component'; import { MainComponent } from './main/main.component'; import { MyAccessStrategy } from './my-access-strategy.service'; From 5c44c5a8937ce464bd1d14cb804a52eed7b83004 Mon Sep 17 00:00:00 2001 From: Chihab Otmani Date: Sun, 4 Apr 2021 15:28:18 +0100 Subject: [PATCH 5/7] feat: user module provider with no barrel for compat --- projects/core/src/lib/core.module.ts | 4 ++++ projects/core/src/lib/services/access.guard.ts | 4 +--- projects/core/src/lib/services/access.service.ts | 7 ++----- projects/core/src/lib/services/index.ts | 2 -- projects/core/src/public-api.ts | 2 ++ 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/projects/core/src/lib/core.module.ts b/projects/core/src/lib/core.module.ts index 64cd51d..99f1c9b 100644 --- a/projects/core/src/lib/core.module.ts +++ b/projects/core/src/lib/core.module.ts @@ -1,6 +1,8 @@ import { ModuleWithProviders, NgModule } from '@angular/core'; import { AccessServiceConfig, ACCESS_CONFIG } from './config'; import { AccessDirective } from './directives/access.directive'; +import { AccessGuard } from './services/access.guard'; +import { AccessService } from './services/access.service'; @NgModule({ declarations: [AccessDirective], @@ -13,6 +15,8 @@ export class AccessModule { return { ngModule: AccessModule, providers: [ + AccessService, + AccessGuard, { provide: ACCESS_CONFIG, useValue: { diff --git a/projects/core/src/lib/services/access.guard.ts b/projects/core/src/lib/services/access.guard.ts index 0a89b1e..4e4c146 100644 --- a/projects/core/src/lib/services/access.guard.ts +++ b/projects/core/src/lib/services/access.guard.ts @@ -11,9 +11,7 @@ import { tap } from 'rxjs/operators'; import { AccessService } from './access.service'; import { AccessServiceConfig, ACCESS_CONFIG } from '../config'; -@Injectable({ - providedIn: 'root', -}) +@Injectable() export class AccessGuard implements CanActivate, CanLoad { constructor( private router: Router, diff --git a/projects/core/src/lib/services/access.service.ts b/projects/core/src/lib/services/access.service.ts index d713e93..23a76ff 100644 --- a/projects/core/src/lib/services/access.service.ts +++ b/projects/core/src/lib/services/access.service.ts @@ -3,17 +3,14 @@ import { Observable } from 'rxjs'; import { AccessServiceConfig, ACCESS_CONFIG } from '../config'; import { AccessConfiguration } from '../helpers'; import { + canAccessExpression, canAccessPaths, setConfigurationAccess, setHasAccessStrategy, - canAccessExpression, - HasAccessStrategy, } from '../helpers/access-helpers'; import { AccessStrategy } from './access-strategy.service'; -@Injectable({ - providedIn: 'root', -}) +@Injectable() export class AccessService { constructor( @Inject(ACCESS_CONFIG) config: AccessServiceConfig, diff --git a/projects/core/src/lib/services/index.ts b/projects/core/src/lib/services/index.ts index e4f6a74..54605fc 100644 --- a/projects/core/src/lib/services/index.ts +++ b/projects/core/src/lib/services/index.ts @@ -1,3 +1 @@ -export * from './access.guard'; -export * from './access.service'; export * from './access-strategy.service'; diff --git a/projects/core/src/public-api.ts b/projects/core/src/public-api.ts index cefbe92..6b765c5 100644 --- a/projects/core/src/public-api.ts +++ b/projects/core/src/public-api.ts @@ -1,5 +1,7 @@ export * from './lib/directives'; export * from './lib/helpers'; export * from './lib/services'; +export * from './lib/services/access.service'; +export * from './lib/services/access.guard'; export * from './lib/config'; export * from './lib/core.module'; From 1d1cf5fa6aa45aeafe8f7105ad218fd9a5d0cc73 Mon Sep 17 00:00:00 2001 From: Chihab Otmani Date: Sun, 4 Apr 2021 15:51:32 +0100 Subject: [PATCH 6/7] feat: update doc and version --- README.md | 13 +++++-------- projects/core/package.json | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 4223286..10c9493 100644 --- a/README.md +++ b/README.md @@ -91,19 +91,16 @@ npm install --save ngx-access ## Compatibility -ngx-access version 1.4 and above has verified compatibility with the following Angular versions. +ngx-access version >= 1.4.2 and above has verified compatibility with the following Angular versions. | Angular version | ngx-access version | | --------------- | ------------------ | | 11.x | ✅ | | 10.x | ✅ | -| 9.x | 🚧 | -| 8.x | 🚧 | -| 7.x | 🚧 | -| 6.x | 🚧 | -| 5.x | 🚧 | -| 4.x | 🚧 | -| 2.x | 🚧 | +| 9.x | ✅ | +| 8.x | ✅ | +| 7.x | ✅ | +| 6.x | ✅ | If the version you are using is not listed, please [raise an issue in our GitHub repository](https://github.com/chihab/ngx-access/issues/new). diff --git a/projects/core/package.json b/projects/core/package.json index 993d16d..bbc3da2 100644 --- a/projects/core/package.json +++ b/projects/core/package.json @@ -1,6 +1,6 @@ { "name": "ngx-access", - "version": "1.4.1", + "version": "1.4.2", "description": "Add access control to your components using hierarchical configuration with logical expressions.", "author": "Chihab Otmani", "repository": { From d46eb0602d71636e3d081d5fc8342aaa02a3c67a Mon Sep 17 00:00:00 2001 From: Chihab Otmani Date: Sun, 4 Apr 2021 15:53:20 +0100 Subject: [PATCH 7/7] chore: remove unused packages --- package-lock.json | 16 ---------------- package.json | 2 -- 2 files changed, 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index 95609e4..970dbfe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -228,14 +228,6 @@ } } }, - "@angular/animations": { - "version": "11.2.7", - "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-11.2.7.tgz", - "integrity": "sha512-i+H5vC2/NUqZwGeoDHpLDn81R3prQGwT1AajMqFw9D3U6VX6G5EfYmn1zLvu8nL2r4cYMsSQ/LKnKl2jnQX0sQ==", - "requires": { - "tslib": "^2.0.0" - } - }, "@angular/cli": { "version": "11.2.6", "resolved": "https://registry.npmjs.org/@angular/cli/-/cli-11.2.6.tgz", @@ -418,14 +410,6 @@ "tslib": "^2.0.0" } }, - "@angular/forms": { - "version": "11.2.7", - "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-11.2.7.tgz", - "integrity": "sha512-MhNRZ0Su0z9Lof5wxJbaslIdEbG1C39RJ/xyeIm6+vZ5eCXnC3DqPuD4UIoWCgDQXFZW2pjdIePpLLYZnRNGRg==", - "requires": { - "tslib": "^2.0.0" - } - }, "@angular/platform-browser": { "version": "11.2.7", "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-11.2.7.tgz", diff --git a/package.json b/package.json index 9153a90..5eeb2a8 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,9 @@ }, "private": true, "dependencies": { - "@angular/animations": "~11.2.7", "@angular/common": "~11.2.7", "@angular/compiler": "~11.2.7", "@angular/core": "~11.2.7", - "@angular/forms": "~11.2.7", "@angular/platform-browser": "~11.2.7", "@angular/platform-browser-dynamic": "~11.2.7", "@angular/router": "~11.2.7",