Skip to content

Atomic postures and mfa-flows assignments - #3590

Open
j-chmielewski wants to merge 29 commits into
devfrom
atomic-assignments
Open

Atomic postures and mfa-flows assignments#3590
j-chmielewski wants to merge 29 commits into
devfrom
atomic-assignments

Conversation

@j-chmielewski

@j-chmielewski j-chmielewski commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Related issue: #3563

  • Posture check and MFA flow assignments are now part of the location payload.
  • Removed the standalone assignment endpoints that wrote outside the location form.
  • License gating moved into the location save path.
  • Location edits are no longer blocked by an expired license.
  • Assignment events fire only on real changes.
  • Frontend saves assignments with the location form.
  • LocationMfaFlowItem now returns group_ids alongside group_names, so the
    client can round-trip assignments without a name lookup.

@j-chmielewski j-chmielewski changed the title posture checks part of location update Atomic postures and mfa-flows assignments Aug 21, 2026
);
let mfa_assignments = normalize_mfa_flow_assignments(data.mfa_flows.clone());
let mfa_assignments_changed = current_mfa_assignments != mfa_assignments;
let mfa_assignments_updated = mfa_assignments_changed && is_business_license_active();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the license is not active this just makes the assignment fail silently. We should probably at least log a debug/warning message.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also this seems to block adding the default flow in the free tier.

"User {} updated WireGuard network {network_id}",
session.user.username,
);
if postures_changed {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The validate -> assign -> emit event flow is similar between create and modify endpoints. Maybe consider extracting a helper?

}

/// Validates whether the current license permits the requested MFA flow assignments.
async fn validate_mfa_flow_assignments(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this is the correct place for the validation logic. Consider putting it next to MfaFlow::assign_to_location.

}

// Free can't assign multi-step flows.
if let Some(assignment) = assignments.first() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Free should also have no more than one flow assigned. This is probably already the case due to earlier checks, but maybe add some explicit logic so a refactor does not break validation.

]),
)
.await;
assert_assignment_license_error(response, "group_assignment_not_allowed").await;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm the operation is atomic we should check that no assignment is created in the DB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants