Public Access
Make the vault the thing you share, and ask a host which one it lives in
The teams screen listed teams that owned vaults, so sharing four servers with two
colleagues meant creating a team, then a vault inside it, then wrapping a key.
Two of those three steps are about a concept nobody arrives wanting. The screen
now lists vaults: naming one creates the membership list that carries it, named
after the vault and owned by you, and members, invitations, roles, hand-over and
key holders all hang off the vault they apply to.
Nothing on the server moved. VaultAccessService still resolves a shared vault
through team_membership and every membership call still names a team id — what
went is the requirement that anybody make one. The split the whole design rests
on is untouched and is still what the screen is built around: adding somebody
authorises the server to serve them, and only a machine holding the key can make
the vault readable. ADR 0009 keeps its decision and gains an addendum recording
which half of it a person is now asked about.
The one place the team resurfaces is a membership list carrying several vaults,
which this screen cannot produce and does not hide: the members section says so,
because "adding somebody here adds them there" is precisely the fact a
vault-shaped screen is in a position to conceal.
Two things left the interface and one arrived. Creating a team is gone, and so is
archiving one — it was only ever possible for a team owning no vaults, and a
screen whose rows are vaults has no row for one, so the button would have been
unreachable or always refused. The endpoint is unchanged and the screen states
the limit instead, since a vault cannot be deleted at all. The exception is a
create whose second call failed: cancelling that form archives the membership
list it left behind, which is a deliberate departure from this client's rule
against tidying up on the user's behalf, made because nothing else can reach it.
What arrived is PUT /api/v1/vaults/{id}. Without it the screen loses its only
editing action, since renaming the team behind a vault is invisible to everybody
who was never shown the team. It is gated on PermissionFlags.Admin — the line
UpdateTeamEndpoint already draws, because a name is what everybody in the vault
sees it called rather than part of its contents — and it renames the owning team
with it when that team carries nothing else, so the row an operator reads and the
name a user says cannot drift apart. The slug never moves, for the reason it does
not move on a team rename. The session edits its cached vault row rather than
replacing it with the response, which deliberately carries no wrapped key.
The host editor now asks which vault a host goes into, beside the name, while
adding and only where there is more than one vault to write to. It is a second
picker rather than the keychain screen's reused, and the two selections are
separate on purpose: that one is a standing preference about where new items go,
this is a field of the host in front of you, and binding both to one selection
would mean a click on the other screen could move a half-typed host. An existing
host is not offered it at all rather than offered it disabled — the two vaults
are encrypted under different keys, so moving an item is a delete and a retype.
That forced a fix worth naming. The group picker was built from the active
vault's groups whatever vault the host was being filed into, so a host put in a
shared vault could be filed under a group only its author can resolve — a
colleague would see it filed under nothing, which is the quietest kind of wrong.
Groups are now kept per vault and the picker follows the vault choice.
Two renames, because the pair they would otherwise have made is a bug farm:
ShellScreen.Vault became Keychain and VaultScreen became KeychainScreen, which is
what the rail has always labelled that screen, leaving Vault for one vault's
contents and Vaults for the vaults themselves. The enum values are unchanged;
NavRail.axaml writes them as x:Static literals.
1536 tests pass, seven more than before. Five are new on the server — the rename
endpoint's success, the team it does and does not take with it, the two refusals
and the empty name — and the client suite gains six and folds four together,
having lost the two about archiving a team.
This commit is contained in:
@@ -151,6 +151,71 @@ internal sealed class VaultGrantService(
|
||||
: name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Renames a vault, and the team behind it where that team exists to carry this vault alone.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <b>The team is renamed with it, and only when it owns nothing else.</b> A vault made from the
|
||||
/// vaults screen gets a team of its own named after it, and that team is not a thing the person who
|
||||
/// made it was ever shown — so a rename that moved the vault's name and left the team's would leave
|
||||
/// the operator, the logs and the database naming it something nobody uses. A team owning several
|
||||
/// vaults is a different situation: it has a name of its own that somebody chose, and renaming one of
|
||||
/// its vaults must not take it.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// The slug never moves, exactly as <c>UpdateTeamRequest</c> records: it is unique only among live
|
||||
/// teams, so a rename that changed it could take one an archived team is still holding.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
internal async Task<VaultSummary> RenameVaultAsync(
|
||||
Vault vault,
|
||||
UpdateVaultRequest request,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
var name = RequireVaultName(request.Name);
|
||||
|
||||
vault.Name = name;
|
||||
vault.UpdatedAtUtc = clock.GetUtcNow();
|
||||
|
||||
if (vault.TeamId is { } teamId)
|
||||
{
|
||||
var alone = !await database.Vaults
|
||||
.AnyAsync(
|
||||
other => other.TeamId == teamId
|
||||
&& other.Id != vault.Id
|
||||
&& other.DeletedAtUtc == null,
|
||||
cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (alone)
|
||||
{
|
||||
var team = await database.Teams
|
||||
.SingleOrDefaultAsync(t => t.Id == teamId && t.DeletedAtUtc == null, cancellationToken)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (team is not null)
|
||||
{
|
||||
team.Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await database.SaveChangesAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
TeamLog.VaultRenamed(logger, vault.Id, vault.TeamId);
|
||||
|
||||
return new VaultSummary(
|
||||
VaultId: vault.Id,
|
||||
Name: name,
|
||||
IsPersonal: vault.OwnerKind == VaultOwnerKind.Personal,
|
||||
TeamId: vault.TeamId,
|
||||
KeyGeneration: (uint)vault.KeyGeneration,
|
||||
Permissions: 0,
|
||||
WrappedVaultKey: null,
|
||||
RekeyRequired: vault.RekeyRequired);
|
||||
}
|
||||
|
||||
/// <summary>Lists who can open a vault.</summary>
|
||||
internal async Task<VaultGrantsResponse> ListGrantsAsync(
|
||||
Vault vault,
|
||||
|
||||
Reference in New Issue
Block a user