Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion webapp/src/ts/directives/auth.directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,27 @@ import * as _ from 'lodash-es';
import { Directive, Input, HostBinding, OnChanges } from '@angular/core';
import { AuthService } from '../services/auth.service';

/**
* A single property accepted by `mmAuthAny`. Reflects the runtime branches
* in the directive's `dynamicChecks`:
* - `true` -> short-circuit allow (line: mmAuthAny.some(p => p === true))
* - string -> a single permission name
* - string[] -> an AND-group of permission names (flattened via _.flattenDeep)
*/
type AuthAnyValue = boolean | string | string[];

/**
* `mmAuthAny` accepts either a single AuthAnyValue (auto-wrapped to a one-element array
* at runtime) or an array of them representing OR-of-AND-groups.
*/
type AuthAnyInput = AuthAnyValue | AuthAnyValue[];

@Directive({
selector: '[mmAuth]'
})
export class AuthDirective implements OnChanges {
@Input() mmAuth?: string;
@Input() mmAuthAny?: any;
@Input() mmAuthAny?: AuthAnyInput;
@Input() mmAuthOnline?: boolean;

private hidden = true;
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/ts/training-card.guard.provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import { Selectors } from '@mm-selectors/index';
@Injectable({
providedIn: 'root'
})
export class TrainingCardDeactivationGuardProvider implements CanDeactivate<any> {
export class TrainingCardDeactivationGuardProvider implements CanDeactivate<unknown> {
private readonly globalActions: GlobalActions;

constructor(private readonly store: Store) {
this.globalActions = new GlobalActions(this.store);
}

canDeactivate(
component: any,
component: unknown,
currentRoute: ActivatedRouteSnapshot,
currentState: RouterStateSnapshot,
nextState: RouterStateSnapshot,
Expand Down