angular-firebase-authorizator
Version:
Beta version of authorizator for angular linked to firebase, it creates a model in firestore to assign permissions to users an roles, and creates a view to update this permissions
36 lines (35 loc) • 2.23 kB
TypeScript
import { ResourceObj } from '../classes/resource-obj';
import { RoleObj } from '../classes/role-obj';
import { UserObj } from '../classes/user-obj';
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
import { Observable } from 'rxjs';
export declare class AuthGuard implements CanActivate {
private router;
private authorizatorservice;
constructor(router: Router, authorizatorservice: AuthorizatorService);
private isAuthorized;
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>;
}
export declare class AuthorizatorService {
constructor();
addUser(rootFirebasePath: string, user: UserObj): Promise<null>;
removeUser(rootFirebasePath: string, userId: string): Promise<null>;
getUser(rootFirebasePath: string, userId: string): Promise<UserObj>;
getUsers(rootFirebasePath: string): Promise<UserObj[]>;
updateUserPermissions(rootFirebasePath: string, user: UserObj): Promise<unknown>;
addResource(rootFirebasePath: string, resource: ResourceObj): Promise<string>;
removeResource(rootFirebasePath: string, resourceId: string): Promise<null>;
updateResource(rootFirebasePath: string, resource: ResourceObj): Promise<null>;
getResource(rootFirebasePath: string, resourceId: string): Promise<ResourceObj>;
getResources(rootFirebasePath: string): Promise<ResourceObj[]>;
addRole(rootFirebasePath: string, role: RoleObj): Promise<string>;
removeRole(rootFirebasePath: string, roleId: string): Promise<null>;
updateRole(rootFirebasePath: string, role: RoleObj): Promise<null>;
getRole(rootFirebasePath: string, roleId: string): Promise<RoleObj>;
getRoles(rootFirebasePath: string): Promise<RoleObj[]>;
getRolesByResource(rootFirebasePath: string, resourceId: string): Promise<RoleObj[]>;
getRolesByUser(rootFirebasePath: string, userId: string): Promise<RoleObj[]>;
updateRolePermissions(rootFirebasePath: string, role: RoleObj): Promise<unknown>;
removeUserFromRole(rootFirebasePath: string, userId: string): Promise<null>;
getUsersByResource(rootFirebasePath: string, resourceId: string): Promise<UserObj[]>;
}