fix(auth): C3 review — surface seam not-found (no silent success), partial-reconcile-failure guidance, create validation order, concurrent-edit reconciler test
This commit is contained in:
@@ -170,6 +170,12 @@
|
||||
{
|
||||
_formError = null;
|
||||
|
||||
if (!IsEditMode && string.IsNullOrWhiteSpace(_formName))
|
||||
{
|
||||
_formError = "Name is required.";
|
||||
return;
|
||||
}
|
||||
|
||||
// The seam/server reject empty scope sets; validate in the UI for a clear message.
|
||||
if (_selectedMethodNames.Count == 0)
|
||||
{
|
||||
@@ -182,13 +188,16 @@
|
||||
if (_editingKey != null)
|
||||
{
|
||||
// Edit: name is fixed; only the method-scope set is mutable.
|
||||
await ApiKeyAdmin.SetMethodsAsync(_editingKey.KeyId, _selectedMethodNames.ToList());
|
||||
var ok = await ApiKeyAdmin.SetMethodsAsync(_editingKey.KeyId, _selectedMethodNames.ToList());
|
||||
if (!ok)
|
||||
{
|
||||
_formError = $"API key '{_editingKey.Name}' was not found. Reload and retry.";
|
||||
return;
|
||||
}
|
||||
NavigationManager.NavigateTo("/admin/api-keys");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_formName)) { _formError = "Name is required."; return; }
|
||||
|
||||
var created = await ApiKeyAdmin.CreateAsync(_formName.Trim(), _selectedMethodNames.ToList());
|
||||
_newlyCreatedKeyId = created.KeyId;
|
||||
_newlyCreatedToken = created.Token; // shown once; never persisted client-side.
|
||||
|
||||
Reference in New Issue
Block a user