This commit is contained in:
@@ -124,6 +124,13 @@ func Apply(ctx context.Context, tx pgx.Tx, input Input) (Result, error) {
|
||||
if err != nil {
|
||||
return Result{}, fmt.Errorf("parse stored device activation state: %w", err)
|
||||
}
|
||||
var enrollmentMode string
|
||||
if err := tx.QueryRow(ctx, `SELECT enrollment_mode FROM device WHERE id=$1::uuid`, input.DeviceID).Scan(&enrollmentMode); err != nil {
|
||||
return Result{}, err
|
||||
}
|
||||
if enrollmentMode == "physical_confirm" && input.Source != "onboarding" && (target == Active || target == Bound || target == Provisioning) {
|
||||
return Result{}, ErrTransitionRejected
|
||||
}
|
||||
if input.ExpectedRevision != nil && revision != *input.ExpectedRevision {
|
||||
return Result{}, ErrRevisionConflict
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user