UNPKG

@sassoftware/vi-api

Version:
79 lines (78 loc) 2.36 kB
export declare enum IdentityState { Active = "active", Inactive = "inactive", Locked = "locked" } export declare enum IdentityType { User = "user", Group = "group" } export interface IdentitySummary { id: string; name?: string; description?: string; creationTimeStamp?: string; modifiedTimeStamp?: string; providerId?: string; state?: IdentityState; type: IdentityType; } export interface IdentityFlatMembership { id: string; name: string; providerId: string; implicit: boolean; parentsIds?: string[]; topLevel: boolean; } export interface UserSummary extends IdentitySummary { readonly type: IdentityType.User; } export interface SessionDetails { authorizedFeatures: string[]; displayName: string; id: string; softwareVersionNumber: string; } /** * This API is used to get the details and functionality associated with the current user. * * Accessed from the window at `window.sas.vi.currentUser`. * * @example window.sas.vi.currentUser.getSessionDetails(); * @category API */ export interface CurrentUserApi { /** * @method * @description Gets the object containing the users current session details. * @returns The user's current session details. */ getSessionDetails(): SessionDetails; /** * @method * @description Gets the object containing the current user details. * @returns The current user details. */ getUserDetails(): Promise<UserSummary>; /** * @method * @description Gets the list of groups to which the current user belongs. * @param limit Maximum number of groups to be returned. Default: 1000. * @returns A list of group details. */ getUserMemberships(limit?: number): Promise<IdentityFlatMembership[]>; /** * @method * @description Verifies if the current user has administration features. * @returns A boolean value indicating if the user has access to the administration features. */ hasAdminFeatures(): boolean; /** * @method * @description Verifies if the current user has a set of features. * @param features {string[]} Identifiers of the required features. * @returns A boolean value indicating if the user has access to the features. */ hasFeatures(features: string[]): boolean; }