Skip to content
This repository was archived by the owner on Sep 7, 2022. It is now read-only.

Commit e6e18fd

Browse files
authored
Merge pull request #29 from chihab/feat/compatibilty
feat: add compatibilty for ng >= 6
2 parents 4f8e782 + d46eb06 commit e6e18fd

File tree

14 files changed

+21
-48
lines changed

14 files changed

+21
-48
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,19 +91,16 @@ npm install --save ngx-access
9191

9292
## Compatibility
9393

94-
ngx-access version 1.4 and above has verified compatibility with the following Angular versions.
94+
ngx-access version >= 1.4.2 and above has verified compatibility with the following Angular versions.
9595

9696
| Angular version | ngx-access version |
9797
| --------------- | ------------------ |
9898
| 11.x ||
9999
| 10.x ||
100-
| 9.x | 🚧 |
101-
| 8.x | 🚧 |
102-
| 7.x | 🚧 |
103-
| 6.x | 🚧 |
104-
| 5.x | 🚧 |
105-
| 4.x | 🚧 |
106-
| 2.x | 🚧 |
100+
| 9.x ||
101+
| 8.x ||
102+
| 7.x ||
103+
| 6.x ||
107104

108105
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).
109106

angular.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@
5050
"type": "initial",
5151
"maximumWarning": "500kb",
5252
"maximumError": "1mb"
53-
},
54-
{
55-
"type": "anyComponentStyle",
56-
"maximumWarning": "2kb",
57-
"maximumError": "4kb"
5853
}
5954
]
6055
}

package-lock.json

Lines changed: 0 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88
"build": "ng build --prod core",
99
"test": "ng test core --watch=false --browsers=ChromeHeadless",
1010
"test:watch": "ng test core --browsers=ChromeHeadless",
11-
"build:demo": "ng build --prod ngx-access"
11+
"build:demo": "ng build --prod ngx-access",
12+
"versem": "node ../versem/packages/cli/dist/index.js apply -t 8.0.x"
1213
},
1314
"private": true,
1415
"dependencies": {
15-
"@angular/animations": "~11.2.7",
1616
"@angular/common": "~11.2.7",
1717
"@angular/compiler": "~11.2.7",
1818
"@angular/core": "~11.2.7",
19-
"@angular/forms": "~11.2.7",
2019
"@angular/platform-browser": "~11.2.7",
2120
"@angular/platform-browser-dynamic": "~11.2.7",
2221
"@angular/router": "~11.2.7",

projects/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngx-access",
3-
"version": "1.4.1",
3+
"version": "1.4.2",
44
"description": "Add access control to your components using hierarchical configuration with logical expressions.",
55
"author": "Chihab Otmani",
66
"repository": {

projects/core/src/lib/core.module.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { ModuleWithProviders, NgModule } from '@angular/core';
22
import { AccessServiceConfig, ACCESS_CONFIG } from './config';
33
import { AccessDirective } from './directives/access.directive';
4+
import { AccessGuard } from './services/access.guard';
5+
import { AccessService } from './services/access.service';
46

57
@NgModule({
68
declarations: [AccessDirective],
@@ -13,6 +15,8 @@ export class AccessModule {
1315
return {
1416
ngModule: AccessModule,
1517
providers: [
18+
AccessService,
19+
AccessGuard,
1620
{
1721
provide: ACCESS_CONFIG,
1822
useValue: {

projects/core/src/lib/directives/access.directive.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Observable, of } from 'rxjs';
22
import { Component } from '@angular/core';
33
import { ComponentFixture, TestBed } from '@angular/core/testing';
44
import { By } from '@angular/platform-browser';
5-
import { AccessModule } from '../../public-api';
5+
import { AccessModule } from '../core.module';
66
import { AccessStrategy } from '../services/access-strategy.service';
77

88
@Component({

projects/core/src/lib/services/access.guard.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ import { tap } from 'rxjs/operators';
1111
import { AccessService } from './access.service';
1212
import { AccessServiceConfig, ACCESS_CONFIG } from '../config';
1313

14-
@Injectable({
15-
providedIn: 'root',
16-
})
14+
@Injectable()
1715
export class AccessGuard implements CanActivate, CanLoad {
1816
constructor(
1917
private router: Router,

projects/core/src/lib/services/access.service.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,14 @@ import { Observable } from 'rxjs';
33
import { AccessServiceConfig, ACCESS_CONFIG } from '../config';
44
import { AccessConfiguration } from '../helpers';
55
import {
6+
canAccessExpression,
67
canAccessPaths,
78
setConfigurationAccess,
89
setHasAccessStrategy,
9-
canAccessExpression,
10-
HasAccessStrategy,
1110
} from '../helpers/access-helpers';
1211
import { AccessStrategy } from './access-strategy.service';
1312

14-
@Injectable({
15-
providedIn: 'root',
16-
})
13+
@Injectable()
1714
export class AccessService {
1815
constructor(
1916
@Inject(ACCESS_CONFIG) config: AccessServiceConfig,
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export * from './access.guard';
2-
export * from './access.service';
31
export * from './access-strategy.service';

projects/core/src/public-api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
export * from './lib/directives';
22
export * from './lib/helpers';
33
export * from './lib/services';
4+
export * from './lib/services/access.service';
5+
export * from './lib/services/access.guard';
46
export * from './lib/config';
57
export * from './lib/core.module';

src/app/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Component, OnInit } from '@angular/core';
2-
import { AccessService, AccessStrategy } from 'projects/core/src/public-api';
2+
import { AccessService, AccessStrategy } from 'ngx-access';
33

44
@Component({
55
selector: 'app-root',

src/app/app.module.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ import {
66
AccessConfiguration,
77
AccessGuard,
88
AccessModule,
9+
AccessService,
910
AccessStrategy,
1011
} from 'ngx-access';
11-
import { AccessService } from 'projects/core/src/public-api';
1212
import { of } from 'rxjs';
13-
import { catchError, tap } from 'rxjs/operators';
13+
import { catchError } from 'rxjs/operators';
1414
import { AppComponent } from './app.component';
1515
import { MainComponent } from './main/main.component';
1616
import { MyAccessStrategy } from './my-access-strategy.service';

tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/* To learn more about this file see: https://angular.io/config/tsconfig. */
21
{
32
"compileOnSave": false,
43
"compilerOptions": {

0 commit comments

Comments
 (0)