mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-03 17:54:05 +00:00
16 lines
489 B
TypeScript
16 lines
489 B
TypeScript
import type { InvitationRoleOption } from "@/types/onboarding-invite";
|
|
|
|
const ADMIN_ROLE_NAME = "admin";
|
|
|
|
export const isAdminRole = (role: InvitationRoleOption) =>
|
|
role.name.toLowerCase() === ADMIN_ROLE_NAME;
|
|
|
|
/** Admin first: the natural pick for a teammate who has to finish the setup. */
|
|
export function orderRolesAdminFirst(
|
|
roles: InvitationRoleOption[],
|
|
): InvitationRoleOption[] {
|
|
return [...roles].sort(
|
|
(a, b) => Number(isAdminRole(b)) - Number(isAdminRole(a)),
|
|
);
|
|
}
|