mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
Merge pull request #3642 from Infisical/misc/add-proper-error-for-bypass-failure
misc: add proper error message for bypass failure
This commit is contained in:
@@ -70,10 +70,25 @@ export const SelectOrganizationSection = () => {
|
|||||||
|
|
||||||
const handleSelectOrganization = useCallback(
|
const handleSelectOrganization = useCallback(
|
||||||
async (organization: Organization) => {
|
async (organization: Organization) => {
|
||||||
const canBypassOrgAuth =
|
const isUserOrgAdmin = organization.userRole === OrgMembershipRole.Admin;
|
||||||
organization.bypassOrgAuthEnabled &&
|
const canBypassOrgAuth = organization.bypassOrgAuthEnabled && isUserOrgAdmin && isAdminLogin;
|
||||||
organization.userRole === OrgMembershipRole.Admin &&
|
|
||||||
isAdminLogin;
|
if (isAdminLogin) {
|
||||||
|
if (!organization.bypassOrgAuthEnabled) {
|
||||||
|
createNotification({
|
||||||
|
text: "This organization does not have bypass org auth enabled",
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!isUserOrgAdmin) {
|
||||||
|
createNotification({
|
||||||
|
text: "Only organization admins can bypass org auth",
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (organization.authEnforced && !canBypassOrgAuth) {
|
if (organization.authEnforced && !canBypassOrgAuth) {
|
||||||
// org has an org-level auth method enabled (e.g. SAML)
|
// org has an org-level auth method enabled (e.g. SAML)
|
||||||
|
|||||||
Reference in New Issue
Block a user