mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-18 08:20:13 +01:00
feat(security): add security setup (#1565)
This commit is contained in:
parent
f4cdf4ab22
commit
480a90b8c2
4 changed files with 28 additions and 1 deletions
|
|
@ -1,6 +1,8 @@
|
|||
import { ModuleWithProviders, NgModule, Optional, SkipSelf } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { NbAuthModule, NbDummyAuthProvider } from '@nebular/auth';
|
||||
import { NbSecurityModule, NbRoleProvider } from '@nebular/security';
|
||||
import { of as observableOf } from 'rxjs/observable/of';
|
||||
|
||||
import { throwIfAlreadyLoaded } from './module-import-guard';
|
||||
import { DataModule } from './data/data.module';
|
||||
|
|
@ -21,6 +23,27 @@ const NB_CORE_PROVIDERS = [
|
|||
},
|
||||
},
|
||||
}).providers,
|
||||
NbSecurityModule.forRoot({
|
||||
accessControl: {
|
||||
guest: {
|
||||
view: '*',
|
||||
},
|
||||
user: {
|
||||
parent: 'guest',
|
||||
create: '*',
|
||||
edit: '*',
|
||||
remove: '*',
|
||||
},
|
||||
},
|
||||
}).providers,
|
||||
{
|
||||
provide: NbRoleProvider,
|
||||
useValue: {
|
||||
getRole: () => {
|
||||
return observableOf('guest'); // here you could provide any role based on any auth flow
|
||||
},
|
||||
},
|
||||
},
|
||||
AnalyticsService,
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue