Skip to content

Instantly share code, notes, and snippets.

@Macadoshis
Created May 23, 2019 13:28
Show Gist options
  • Save Macadoshis/e10c6899a5d43b858508691a51158389 to your computer and use it in GitHub Desktop.
Save Macadoshis/e10c6899a5d43b858508691a51158389 to your computer and use it in GitHub Desktop.
Index: CMSS.Client/src/app/utils/router/cmss.router.types.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- CMSS.Client/src/app/utils/router/cmss.router.types.ts (date 1558607972000)
+++ CMSS.Client/src/app/utils/router/cmss.router.types.ts (date 1555529891368)
@@ -10,7 +10,7 @@
protected _permissions: Permission[];
- constructor(protected permissionService: PermissionService, permissions: Permission | Permission[]) {
+ constructor(protected permissionService: PermissionService, permissions: Permission | Permission[], private needsAll: boolean) {
if (!permissions) {
this._permissions = [];
} else if (!isArray(permissions)) {
@@ -21,14 +21,14 @@
}
protected resolvePermissions(): Observable<boolean> {
- return this.permissionService.hasPermissions(this._permissions);
+ return this.permissionService.hasPermissions(this._permissions, !!this.needsAll);
}
}
export abstract class PermissionCanActivate extends PermissionObservable implements CanActivate {
- constructor(permissionService: PermissionService, permissions: Permission | Permission[]) {
- super(permissionService, permissions);
+ constructor(permissionService: PermissionService, permissions: Permission | Permission[], needsAll: boolean = false) {
+ super(permissionService, permissions, needsAll);
}
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
@@ -38,8 +38,8 @@
export abstract class PermissionResolver extends PermissionObservable implements Resolve<boolean> {
- constructor(permissionService: PermissionService, permissions: Permission | Permission[]) {
- super(permissionService, permissions);
+ constructor(permissionService: PermissionService, permissions: Permission | Permission[], needsAll: boolean = false) {
+ super(permissionService, permissions, needsAll);
}
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment