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

Commit

Permalink
Merge pull request #29 from chihab/feat/compatibilty
Browse files Browse the repository at this point in the history
feat: add compatibilty for ng >= 6
  • Loading branch information
chihab committed Apr 4, 2021
2 parents 4f8e782 + d46eb06 commit e6e18fd
Show file tree
Hide file tree
Showing 14 changed files with 21 additions and 48 deletions.
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
5 changes: 0 additions & 5 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
]
}
Expand Down
16 changes: 0 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
"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": {
"@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",
Expand Down
2 changes: 1 addition & 1 deletion projects/core/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
4 changes: 4 additions & 0 deletions projects/core/src/lib/core.module.ts
Original file line number Diff line number Diff line change
@@ -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],
Expand All @@ -13,6 +15,8 @@ export class AccessModule {
return {
ngModule: AccessModule,
providers: [
AccessService,
AccessGuard,
{
provide: ACCESS_CONFIG,
useValue: {
Expand Down
2 changes: 1 addition & 1 deletion projects/core/src/lib/directives/access.directive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
4 changes: 1 addition & 3 deletions projects/core/src/lib/services/access.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 2 additions & 5 deletions projects/core/src/lib/services/access.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions projects/core/src/lib/services/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
export * from './access.guard';
export * from './access.service';
export * from './access-strategy.service';
2 changes: 2 additions & 0 deletions projects/core/src/public-api.ts
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 1 addition & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"compileOnSave": false,
"compilerOptions": {
Expand Down

0 comments on commit e6e18fd

Please sign in to comment.