Skip to content

Commit 2e4a635

Browse files
fix: suppress SSO migration until setup is complete
Guard the forced SSO migration prompt behind initial setup completion. The setup wizard must run first and the SAM app must be configured before ExecSSOSetup can create the CIPP-SSO registration. Backend checks ApplicationID env var; frontend passes setupCompleted prop to ForcedSsoMigrationDialog. Synced from CyberDrain/CIPP@805cd1b
1 parent 6de4806 commit 2e4a635

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

Modules/CIPPCore/Public/Authentication/Test-CIPPAccess.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -236,19 +236,19 @@ function Test-CIPPAccess {
236236
$CanManageAppSettings = $Permissions -contains 'CIPP.AppSettings.ReadWrite'
237237
$HasAnyPermission = ($Permissions | Measure-Object).Count -gt 0
238238

239-
# Forced SSO migration: non-dismissible prompt when migration env var is set
240-
if ($env:CIPP_SSO_MIGRATION_APPID -and $CanManageAppSettings) {
239+
# Forced SSO migration: non-dismissible prompt when migration env var is set.
240+
# Suppressed until initial setup (SAM app) is complete — the setup wizard has
241+
# to run first, and ExecSSOSetup needs the SAM app to create the CIPP-SSO
242+
# registration. Same env check that drives the setupCompleted alert.
243+
$InitialSetupComplete = $env:ApplicationID -and $env:ApplicationID -ne 'LongApplicationID'
244+
if ($env:CIPP_SSO_MIGRATION_APPID -and $CanManageAppSettings -and $InitialSetupComplete) {
241245
$MeResponse['forceSsoMigration'] = @{
242246
appId = $env:CIPP_SSO_MIGRATION_APPID
243247
status = 'pending'
244248
}
245249
}
246250

247-
# SSO migration requires a working SAM app — suppress the nag until initial
248-
# setup is complete (same check GetCippAlerts uses for its setup alert)
249-
$SetupCompleted = $env:ApplicationID -and $env:ApplicationID -ne 'LongApplicationID'
250-
251-
if ($env:CIPPNG -ne 'true' -and $HasAnyPermission -and $SetupCompleted) {
251+
if ($env:CIPPNG -ne 'true' -and $HasAnyPermission) {
252252
try {
253253
$SSOTable = Get-CIPPTable -tablename 'SSOMigration'
254254
$SSOMigration = Get-CIPPAzDataTableEntity @SSOTable -Filter "PartitionKey eq 'SSO' and RowKey eq 'MigrationConfig'" -ErrorAction SilentlyContinue

0 commit comments

Comments
 (0)