mirror of https://github.com/abpframework/abp.git
committed by
GitHub
7 changed files with 66 additions and 16 deletions
@ -1 +1,2 @@ |
|||
export * from './mock-permission.service'; |
|||
export * from './mock-rest.service'; |
|||
|
|||
@ -0,0 +1,34 @@ |
|||
import { ConfigStateService, PermissionService } from '@abp/ng.core'; |
|||
import { Injectable } from '@angular/core'; |
|||
|
|||
@Injectable({ |
|||
providedIn: 'root', |
|||
}) |
|||
export class MockPermissionService extends PermissionService { |
|||
constructor(protected configState: ConfigStateService) { |
|||
super(configState); |
|||
this.grantAllPolicies(); |
|||
} |
|||
|
|||
grantAllPolicies() { |
|||
const grantedPolicies = new Proxy( |
|||
{}, |
|||
{ |
|||
get() { |
|||
return true; |
|||
}, |
|||
}, |
|||
); |
|||
|
|||
this.configState['store'].deepPatch({ auth: { grantedPolicies } }); |
|||
} |
|||
|
|||
grantPolicies(keys: string[]) { |
|||
const grantedPolicies = keys.reduce((policies, key) => { |
|||
policies[key] = true; |
|||
return policies; |
|||
}, {}); |
|||
|
|||
this.configState['store'].deepPatch({ auth: { grantedPolicies } }); |
|||
} |
|||
} |
|||
@ -1 +1,2 @@ |
|||
export * from './lib/core-testing.module'; |
|||
export * from './lib/services'; |
|||
|
|||
Loading…
Reference in new issue