@stardyn/angular-auth
Version:
Angular Authentication Service - Lightweight, configurable authentication service for Angular applications with token management and role-based access control
25 lines (24 loc) • 1.06 kB
TypeScript
import { TemplateRef, ViewContainerRef, OnInit, OnDestroy } from '@angular/core';
import { AuthService } from '../services/AuthService';
/**
* Structural directive that conditionally includes a template based on user permissions
*
* Usage:
* *xconAuthIfRole="'DEVICE_READ'" - Show if user has DEVICE_READ permission
* *xconAuthIfRole="'DEVICE_READ | DEVICE_WRITE'" - Show if user has any of the specified permissions (pipe syntax)
* *xconAuthIfRole="['DEVICE_READ', 'DEVICE_WRITE']" - Show if user has any of the specified permissions (array syntax)
*/
export declare class XconAuthIfRoleDirective implements OnInit, OnDestroy {
private templateRef;
private viewContainer;
private authService;
private hasView;
private subscription;
private _requiredPermissions;
set xconAuthIfRole(permissions: string | string[]);
constructor(templateRef: TemplateRef<any>, viewContainer: ViewContainerRef, authService: AuthService);
ngOnInit(): void;
ngOnDestroy(): void;
private updateView;
private checkUserPermissions;
}