import { EEntity, EPermission } from './constants'; import type { ISecureItem, IUser } from './interfaces'; /** * Options of a logout action. */ export interface ILogoutOptions { /** * Logout message. */ msg: string; /** * Redirect URL for the client to actually logout. */ redirect?: string; } export declare class UserSession { static GLOBAL_EVENT_USER_LOGGED_IN: string; static GLOBAL_EVENT_USER_LOGGED_OUT: string; /** * Simply store the current user as variable instead of any browser storage */ private loggedInUser; /** * resets the stored session data that will be automatically filled during login */ reset: () => void; /** * whether the user is logged in * @returns {boolean} */ isLoggedIn: () => boolean; /** * stores the given user information * @param user */ login: (user: IUser) => void; /** * logs the current user out */ logout: (options: ILogoutOptions) => void; /** * returns the current user or null * @returns {IUser | null} */ currentUser: () => IUser | null; /** * returns the current user name else an anonymous user name */ currentUserNameOrAnonymous: () => string; can: (item: ISecureItem, permission: EPermission, user?: IUser) => boolean; /** * check whether the given user can read the given item * @param item the item to check * @param user the user by default the current user * @returns {boolean} */ canRead: (item: ISecureItem, user?: IUser) => boolean; /** * check whether the given user can write the given item * @param item the item to check * @param user the user by default the current user * @returns {boolean} */ canWrite: (item: ISecureItem, user?: IUser) => boolean; /** * check whether the given user can execute the given item * @param item the item to check * @param user the user by default the current user * @returns {boolean} */ canExecute: (item: ISecureItem, user?: IUser) => boolean; hasPermission(item: ISecureItem, entity?: EEntity, permission?: EPermission): boolean; private isEqual; private includes; /** * @deprecated Use `userSession` instead. */ static getInstance(): UserSession; } export declare const userSession: UserSession; //# sourceMappingURL=UserSession.d.ts.map