mirror of https://github.com/abpframework/abp.git
5 changed files with 126 additions and 29 deletions
@ -0,0 +1,49 @@ |
|||
import { Routes } from '@angular/router'; |
|||
import { |
|||
authGuard, |
|||
permissionGuard, |
|||
ReplaceableComponents, |
|||
ReplaceableRouteContainerComponent, |
|||
RouterOutletComponent, |
|||
} from '@abp/ng.core'; |
|||
import { RolesComponent, UsersComponent } from './components'; |
|||
import { identityExtensionsResolver } from './resolvers'; |
|||
import { provideIdentity } from './identity'; |
|||
import { eIdentityComponents } from './enums'; |
|||
|
|||
export const identityRoutes: Routes = [ |
|||
{ |
|||
path: '', |
|||
component: RouterOutletComponent, |
|||
canActivate: [authGuard, permissionGuard], |
|||
resolve: [identityExtensionsResolver], |
|||
providers: [...provideIdentity()], |
|||
children: [ |
|||
{ path: '', redirectTo: 'roles', pathMatch: 'full' }, |
|||
{ |
|||
path: 'roles', |
|||
component: ReplaceableRouteContainerComponent, |
|||
data: { |
|||
requiredPolicy: 'AbpIdentity.Roles', |
|||
replaceableComponent: { |
|||
key: eIdentityComponents.Roles, |
|||
defaultComponent: RolesComponent, |
|||
} as ReplaceableComponents.RouteData<RolesComponent>, |
|||
}, |
|||
title: 'AbpIdentity::Roles', |
|||
}, |
|||
{ |
|||
path: 'users', |
|||
component: ReplaceableRouteContainerComponent, |
|||
data: { |
|||
requiredPolicy: 'AbpIdentity.Users', |
|||
replaceableComponent: { |
|||
key: eIdentityComponents.Users, |
|||
defaultComponent: UsersComponent, |
|||
} as ReplaceableComponents.RouteData<UsersComponent>, |
|||
}, |
|||
title: 'AbpIdentity::Users', |
|||
}, |
|||
], |
|||
}, |
|||
]; |
|||
@ -0,0 +1,35 @@ |
|||
import { |
|||
IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS, |
|||
IDENTITY_EDIT_FORM_PROP_CONTRIBUTORS, |
|||
IDENTITY_ENTITY_ACTION_CONTRIBUTORS, |
|||
IDENTITY_ENTITY_PROP_CONTRIBUTORS, |
|||
IDENTITY_TOOLBAR_ACTION_CONTRIBUTORS, |
|||
} from './tokens'; |
|||
import { IdentityExtensionsGuard } from './guards'; |
|||
import { IdentityConfigOptions } from './models'; |
|||
|
|||
export function provideIdentity(options: IdentityConfigOptions = {}) { |
|||
return [ |
|||
{ |
|||
provide: IDENTITY_ENTITY_ACTION_CONTRIBUTORS, |
|||
useValue: options.entityActionContributors, |
|||
}, |
|||
{ |
|||
provide: IDENTITY_TOOLBAR_ACTION_CONTRIBUTORS, |
|||
useValue: options.toolbarActionContributors, |
|||
}, |
|||
{ |
|||
provide: IDENTITY_ENTITY_PROP_CONTRIBUTORS, |
|||
useValue: options.entityPropContributors, |
|||
}, |
|||
{ |
|||
provide: IDENTITY_CREATE_FORM_PROP_CONTRIBUTORS, |
|||
useValue: options.createFormPropContributors, |
|||
}, |
|||
{ |
|||
provide: IDENTITY_EDIT_FORM_PROP_CONTRIBUTORS, |
|||
useValue: options.editFormPropContributors, |
|||
}, |
|||
IdentityExtensionsGuard, |
|||
]; |
|||
} |
|||
Loading…
Reference in new issue