diff --git a/backend/src/db/migrations/20250416145120_add-enable-bypass-org-auth-flag.ts b/backend/src/db/migrations/20250416145120_add-enable-bypass-org-auth-flag.ts index ef2957545..fb9a12625 100644 --- a/backend/src/db/migrations/20250416145120_add-enable-bypass-org-auth-flag.ts +++ b/backend/src/db/migrations/20250416145120_add-enable-bypass-org-auth-flag.ts @@ -3,17 +3,17 @@ import { Knex } from "knex"; import { TableName } from "../schemas"; export async function up(knex: Knex): Promise { - if (!(await knex.schema.hasColumn(TableName.Organization, "enableBypassOrgAuth"))) { + if (!(await knex.schema.hasColumn(TableName.Organization, "bypassOrgAuthEnabled"))) { await knex.schema.alterTable(TableName.Organization, (t) => { - t.boolean("enableBypassOrgAuth").defaultTo(false).notNullable(); + t.boolean("bypassOrgAuthEnabled").defaultTo(false).notNullable(); }); } } export async function down(knex: Knex): Promise { - if (await knex.schema.hasColumn(TableName.Organization, "enableBypassOrgAuth")) { + if (await knex.schema.hasColumn(TableName.Organization, "bypassOrgAuthEnabled")) { await knex.schema.alterTable(TableName.Organization, (t) => { - t.dropColumn("enableBypassOrgAuth"); + t.dropColumn("bypassOrgAuthEnabled"); }); } } diff --git a/backend/src/db/schemas/organizations.ts b/backend/src/db/schemas/organizations.ts index 3e475fda1..eea1808e0 100644 --- a/backend/src/db/schemas/organizations.ts +++ b/backend/src/db/schemas/organizations.ts @@ -27,7 +27,7 @@ export const OrganizationsSchema = z.object({ shouldUseNewPrivilegeSystem: z.boolean().default(true), privilegeUpgradeInitiatedByUsername: z.string().nullable().optional(), privilegeUpgradeInitiatedAt: z.date().nullable().optional(), - enableBypassOrgAuth: z.boolean().default(false) + bypassOrgAuthEnabled: z.boolean().default(false) }); export type TOrganizations = z.infer; diff --git a/backend/src/ee/services/permission/permission-dal.ts b/backend/src/ee/services/permission/permission-dal.ts index 410e4d48e..891d7193e 100644 --- a/backend/src/ee/services/permission/permission-dal.ts +++ b/backend/src/ee/services/permission/permission-dal.ts @@ -54,7 +54,7 @@ export const permissionDALFactory = (db: TDbClient) => { db.ref("slug").withSchema(TableName.OrgRoles).withSchema(TableName.OrgRoles).as("customRoleSlug"), db.ref("permissions").withSchema(TableName.OrgRoles), db.ref("authEnforced").withSchema(TableName.Organization).as("orgAuthEnforced"), - db.ref("enableBypassOrgAuth").withSchema(TableName.Organization).as("enableBypassOrgAuth"), + db.ref("bypassOrgAuthEnabled").withSchema(TableName.Organization).as("bypassOrgAuthEnabled"), db.ref("groupId").withSchema("userGroups"), db.ref("groupOrgId").withSchema("userGroups"), db.ref("groupName").withSchema("userGroups"), @@ -73,7 +73,7 @@ export const permissionDALFactory = (db: TDbClient) => { OrgMembershipsSchema.extend({ permissions: z.unknown(), orgAuthEnforced: z.boolean().optional().nullable(), - enableBypassOrgAuth: z.boolean(), + bypassOrgAuthEnabled: z.boolean(), customRoleSlug: z.string().optional().nullable(), shouldUseNewPrivilegeSystem: z.boolean() }).parse(el), @@ -678,7 +678,7 @@ export const permissionDALFactory = (db: TDbClient) => { db.ref("key").withSchema(TableName.IdentityMetadata).as("metadataKey"), db.ref("value").withSchema(TableName.IdentityMetadata).as("metadataValue"), db.ref("authEnforced").withSchema(TableName.Organization).as("orgAuthEnforced"), - db.ref("enableBypassOrgAuth").withSchema(TableName.Organization).as("enableBypassOrgAuth"), + db.ref("bypassOrgAuthEnabled").withSchema(TableName.Organization).as("bypassOrgAuthEnabled"), db.ref("role").withSchema(TableName.OrgMembership).as("orgRole"), db.ref("orgId").withSchema(TableName.Project), db.ref("type").withSchema(TableName.Project).as("projectType"), @@ -702,7 +702,7 @@ export const permissionDALFactory = (db: TDbClient) => { membershipUpdatedAt, projectType, shouldUseNewPrivilegeSystem, - enableBypassOrgAuth + bypassOrgAuthEnabled }) => ({ orgId, orgAuthEnforced, @@ -715,7 +715,7 @@ export const permissionDALFactory = (db: TDbClient) => { createdAt: membershipCreatedAt || groupMembershipCreatedAt, updatedAt: membershipUpdatedAt || groupMembershipUpdatedAt, shouldUseNewPrivilegeSystem, - enableBypassOrgAuth + bypassOrgAuthEnabled }), childrenMapper: [ { diff --git a/backend/src/ee/services/permission/permission-fns.ts b/backend/src/ee/services/permission/permission-fns.ts index e532afe05..d645e2bec 100644 --- a/backend/src/ee/services/permission/permission-fns.ts +++ b/backend/src/ee/services/permission/permission-fns.ts @@ -121,7 +121,7 @@ function isAuthMethodSaml(actorAuthMethod: ActorAuthMethod) { function validateOrgSSO( actorAuthMethod: ActorAuthMethod, isOrgSsoEnforced: TOrganizations["authEnforced"], - isOrgSsoBypassEnabled: TOrganizations["enableBypassOrgAuth"], + isOrgSsoBypassEnabled: TOrganizations["bypassOrgAuthEnabled"], orgRole: OrgMembershipRole ) { if (actorAuthMethod === undefined) { diff --git a/backend/src/ee/services/permission/permission-service.ts b/backend/src/ee/services/permission/permission-service.ts index 69dadec00..0082c3d17 100644 --- a/backend/src/ee/services/permission/permission-service.ts +++ b/backend/src/ee/services/permission/permission-service.ts @@ -142,7 +142,7 @@ export const permissionServiceFactory = ({ validateOrgSSO( authMethod, membership.orgAuthEnforced, - membership.enableBypassOrgAuth, + membership.bypassOrgAuthEnabled, membership.role as OrgMembershipRole ); @@ -234,7 +234,7 @@ export const permissionServiceFactory = ({ validateOrgSSO( authMethod, userProjectPermission.orgAuthEnforced, - userProjectPermission.enableBypassOrgAuth, + userProjectPermission.bypassOrgAuthEnabled, userProjectPermission.orgRole ); diff --git a/backend/src/server/routes/v1/organization-router.ts b/backend/src/server/routes/v1/organization-router.ts index 25c3ea7f2..90ca3d255 100644 --- a/backend/src/server/routes/v1/organization-router.ts +++ b/backend/src/server/routes/v1/organization-router.ts @@ -261,7 +261,7 @@ export const registerOrgRouter = async (server: FastifyZodProvider) => { enforceMfa: z.boolean().optional(), selectedMfaMethod: z.nativeEnum(MfaMethod).optional(), allowSecretSharingOutsideOrganization: z.boolean().optional(), - enableBypassOrgAuth: z.boolean().optional() + bypassOrgAuthEnabled: z.boolean().optional() }), response: { 200: z.object({ diff --git a/backend/src/services/org/org-schema.ts b/backend/src/services/org/org-schema.ts index 7b5825e34..2aa793c04 100644 --- a/backend/src/services/org/org-schema.ts +++ b/backend/src/services/org/org-schema.ts @@ -17,5 +17,5 @@ export const sanitizedOrganizationSchema = OrganizationsSchema.pick({ shouldUseNewPrivilegeSystem: true, privilegeUpgradeInitiatedByUsername: true, privilegeUpgradeInitiatedAt: true, - enableBypassOrgAuth: true + bypassOrgAuthEnabled: true }); diff --git a/backend/src/services/org/org-service.ts b/backend/src/services/org/org-service.ts index a5df934d2..c83a1a802 100644 --- a/backend/src/services/org/org-service.ts +++ b/backend/src/services/org/org-service.ts @@ -350,7 +350,7 @@ export const orgServiceFactory = ({ enforceMfa, selectedMfaMethod, allowSecretSharingOutsideOrganization, - enableBypassOrgAuth + bypassOrgAuthEnabled } }: TUpdateOrgDTO) => { const appCfg = getConfig(); @@ -431,7 +431,7 @@ export const orgServiceFactory = ({ enforceMfa, selectedMfaMethod, allowSecretSharingOutsideOrganization, - enableBypassOrgAuth + bypassOrgAuthEnabled }); if (!org) throw new NotFoundError({ message: `Organization with ID '${orgId}' not found` }); return org; diff --git a/backend/src/services/org/org-types.ts b/backend/src/services/org/org-types.ts index 136e6cc84..8a1698015 100644 --- a/backend/src/services/org/org-types.ts +++ b/backend/src/services/org/org-types.ts @@ -73,7 +73,7 @@ export type TUpdateOrgDTO = { enforceMfa: boolean; selectedMfaMethod: MfaMethod; allowSecretSharingOutsideOrganization: boolean; - enableBypassOrgAuth: boolean; + bypassOrgAuthEnabled: boolean; }>; } & TOrgPermission; diff --git a/frontend/src/hooks/api/organization/queries.tsx b/frontend/src/hooks/api/organization/queries.tsx index 5bc6c2c7b..902bb6b09 100644 --- a/frontend/src/hooks/api/organization/queries.tsx +++ b/frontend/src/hooks/api/organization/queries.tsx @@ -111,7 +111,7 @@ export const useUpdateOrg = () => { enforceMfa, selectedMfaMethod, allowSecretSharingOutsideOrganization, - enableBypassOrgAuth + bypassOrgAuthEnabled }) => { return apiRequest.patch(`/api/v1/organization/${orgId}`, { name, @@ -122,7 +122,7 @@ export const useUpdateOrg = () => { enforceMfa, selectedMfaMethod, allowSecretSharingOutsideOrganization, - enableBypassOrgAuth + bypassOrgAuthEnabled }); }, onSuccess: () => { diff --git a/frontend/src/hooks/api/organization/types.ts b/frontend/src/hooks/api/organization/types.ts index 302b635de..e0687922d 100644 --- a/frontend/src/hooks/api/organization/types.ts +++ b/frontend/src/hooks/api/organization/types.ts @@ -9,7 +9,7 @@ export type Organization = { createAt: string; updatedAt: string; authEnforced: boolean; - enableBypassOrgAuth: boolean; + bypassOrgAuthEnabled: boolean; orgAuthMethod: string; scimEnabled: boolean; slug: string; @@ -31,7 +31,7 @@ export type UpdateOrgDTO = { enforceMfa?: boolean; selectedMfaMethod?: MfaMethod; allowSecretSharingOutsideOrganization?: boolean; - enableBypassOrgAuth?: boolean; + bypassOrgAuthEnabled?: boolean; }; export type BillingDetails = { diff --git a/frontend/src/pages/auth/SelectOrgPage/SelectOrgPage.tsx b/frontend/src/pages/auth/SelectOrgPage/SelectOrgPage.tsx index 143d7f6bb..7dddd1a4b 100644 --- a/frontend/src/pages/auth/SelectOrgPage/SelectOrgPage.tsx +++ b/frontend/src/pages/auth/SelectOrgPage/SelectOrgPage.tsx @@ -71,7 +71,7 @@ export const SelectOrganizationPage = () => { const handleSelectOrganization = useCallback( async (organization: Organization) => { const canBypassOrgAuth = - organization.enableBypassOrgAuth && + organization.bypassOrgAuthEnabled && organization.userRole === OrgMembershipRole.Admin && isAdminLogin; diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx index fdccaead7..21c440957 100644 --- a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx +++ b/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgGeneralAuthSection.tsx @@ -65,7 +65,7 @@ export const OrgGeneralAuthSection = () => { await mutateAsync({ orgId: currentOrg?.id, - enableBypassOrgAuth: value + bypassOrgAuthEnabled: value }); createNotification({ @@ -129,7 +129,7 @@ export const OrgGeneralAuthSection = () => { level.

- In case of a lockout, admins can use the admin login portal in{" "} + In case of a lockout, admins can use the admin login portal at{" "} { {(isAllowed) => ( handleEnableBypassOrgAuthToggle(value)} isDisabled={!isAllowed} /> diff --git a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgOIDCSection.tsx b/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgOIDCSection.tsx index 727591801..f9d7b939c 100644 --- a/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgOIDCSection.tsx +++ b/frontend/src/pages/organization/SettingsPage/components/OrgAuthTab/OrgOIDCSection.tsx @@ -92,7 +92,7 @@ export const OrgOIDCSection = (): JSX.Element => { await updateOrg({ orgId: currentOrg?.id, - enableBypassOrgAuth: value + bypassOrgAuthEnabled: value }); createNotification({ @@ -212,7 +212,7 @@ export const OrgOIDCSection = (): JSX.Element => { level.

- In case of a lockout, admins can use the admin login portal in{" "} + In case of a lockout, admins can use the admin login portal at{" "} { {(isAllowed) => ( handleEnableBypassOrgAuthToggle(value)} isDisabled={!isAllowed} />