Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | 284x 132x 132x 132x 132x 132x 132x 132x 284x 284x 284x 284x 284x 284x | import { UserStatusType } from "@aws-sdk/client-cognito-identity-provider";
import { UserRole } from "./events/legacy-user";
export { CognitoUser } from "amazon-cognito-identity-js";
export type { UserData } from "amazon-cognito-identity-js";
export type {
APIGatewayEvent,
APIGatewayEventIdentity,
APIGatewayEventRequestContext,
} from "aws-lambda";
export enum UserRoles {
DEFAULT_CMS_USER = "defaultcmsuser",
CMS_REVIEWER = "cmsreviewer",
CMS_ROLE_APPROVER = "cmsroleapprover",
HELPDESK = "helpdesk",
STATE_SUBMITTER = "statesubmitter",
SYSTEM_ADMIN = "systemadmin",
STATE_SYSTEM_ADMIN = "statesystemadmin",
}
export type UserRolesString = `${UserRoles}${"," | ""}` | "";
export type CognitoUserAttributes = {
sub: string;
"custom:cms-roles": UserRolesString; // comma-separated list of UserRoles ex. "onemac-micro-reviewer,onemac-micro-helpdesk" or "onemac-micro-statesubmitter"
"custom:ismemberof"?: UserRolesString;
email_verified: boolean;
"custom:state"?: string; // ex. "VA" or "VA,MD,CA" or undefined
given_name: string;
family_name: string;
email: string;
username: string;
};
export type FullUser = CognitoUserAttributes & {
role: UserRole;
states?: string[];
};
export type UserDetails = {
id: string;
eventType: string;
email: string;
fullName: string;
role: UserRole;
states?: string[];
division: string;
group: string;
};
export const CMS_ROLES = [
"cmsreviewer",
"cmsroleapprover",
"defaultcmsuser",
"helpdesk",
"systemadmin",
] satisfies UserRole[];
export const CMS_WRITE_ROLES = [
"cmsreviewer",
"defaultcmsuser",
"cmsroleapprover",
"systemadmin",
] satisfies UserRole[];
export const CMS_READ_ONLY_ROLES = ["helpdesk"] satisfies UserRole[];
export const USER_MANAGER_ROLES = [
"systemadmin",
"statesystemadmin",
"cmsroleapprover",
"helpdesk",
] satisfies UserRole[];
export const STATE_ROLES = ["statesubmitter", "statesystemadmin"] satisfies UserRole[];
export const RoleDescriptionStrings: { [key: string]: string } = {
[UserRoles.CMS_REVIEWER]: "Reviewer",
[UserRoles.HELPDESK]: "Helpdesk",
[UserRoles.STATE_SUBMITTER]: "State Submitter",
};
export type UserAttributes = {
firstName: string | undefined;
lastName: string | undefined;
email: string | undefined;
states: string | undefined;
roles: string | undefined;
enabled: boolean | undefined;
status: UserStatusType | undefined;
username: string | undefined;
};
|