UNPKG

@propelauth/javascript

Version:

A library for managing authentication in the browser, backed by PropelAuth

73 lines (72 loc) 2.72 kB
import { OrgIdToOrgMemberInfo, OrgRoleStructure } from "./org"; export type UserProperties = { [key: string]: unknown; }; export interface UserFields { userId: string; email: string; createdAt: number; firstName?: string; lastName?: string; username?: string; properties?: UserProperties; pictureUrl?: string; hasPassword?: boolean; hasMfaEnabled?: boolean; canCreateOrgs?: boolean; legacyUserId?: string; impersonatorUserId?: string; } export declare class UserClass { userId: string; orgIdToUserOrgInfo?: OrgIdToOrgMemberInfoClass; email: string; createdAt: number; firstName?: string; lastName?: string; username?: string; properties?: UserProperties; pictureUrl?: string; hasPassword?: boolean; hasMfaEnabled?: boolean; canCreateOrgs?: boolean; legacyUserId?: string; impersonatorUserId?: string; constructor(userFields: UserFields, orgIdToUserOrgInfo?: OrgIdToOrgMemberInfoClass); getOrg(orgId: string): OrgMemberInfoClass | undefined; getOrgByName(orgName: string): OrgMemberInfoClass | undefined; getUserProperty(key: string): unknown | undefined; getOrgs(): OrgMemberInfoClass[]; isImpersonating(): boolean; isRole(orgId: string, role: string): boolean; isAtLeastRole(orgId: string, role: string): boolean; hasPermission(orgId: string, permission: string): boolean; hasAllPermissions(orgId: string, permissions: string[]): boolean; static fromJSON(json: string): UserClass; } export interface OrgIdToOrgMemberInfoClass { [orgId: string]: OrgMemberInfoClass; } export declare class OrgMemberInfoClass { orgId: string; orgName: string; legacyOrgId?: string; orgMetadata: { [key: string]: any; }; urlSafeOrgName: string; orgRoleStructure: OrgRoleStructure; userAssignedRole: string; userInheritedRolesPlusCurrentRole: string[]; userPermissions: string[]; userAssignedAdditionalRoles: string[]; constructor(orgId: string, orgName: string, orgMetadata: { [key: string]: any; }, urlSafeOrgName: string, userAssignedRole: string, userInheritedRolesPlusCurrentRole: string[], userPermissions: string[], orgRoleStructure?: OrgRoleStructure, userAssignedAdditionalRoles?: string[], legacyOrgId?: string); isRole(role: string): boolean; isAtLeastRole(role: string): boolean; hasPermission(permission: string): boolean; hasAllPermissions(permissions: string[]): boolean; static fromJSON(json: string): OrgMemberInfoClass; } export declare function convertOrgIdToOrgMemberInfo(orgIdToOrgMemberInfo: OrgIdToOrgMemberInfo | undefined): OrgIdToOrgMemberInfoClass | undefined;