Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/auth-service/src/cli/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ report!(Option<PictureView>, self, out, {
}
});

// One passkey per line.
// One passkey per line, as `user show` lists them too.
report!([Passkey], self, out, {
out.table(
["ID", "NAME"],
Expand All @@ -480,7 +480,7 @@ report!([Passkey], self, out, {
)
});

// One linked provider per line.
// One linked provider per line, as `user show` lists them too.
report!([Identity], self, out, {
out.table(
["PROVIDER", "EMAIL"],
Expand Down
19 changes: 9 additions & 10 deletions apps/auth-service/src/cli/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use super::{
use crate::{Applied, ClientDetails, GracePeriod, PUBLIC_BASE_URL, Reason};
use clap::{Args, Subcommand};
use sourceorigin_common::{
ClientId,
ClientId, UserId,
admin::{ApprovedOrigin, Client},
clients::{
AllowedScopes, BackchannelLogoutUri, ClientKind, ClientRegistration, DisplayName,
Expand Down Expand Up @@ -292,6 +292,12 @@ impl ClientCommand {
.warning("Store this client secret now: it cannot be shown again.")
}

/// Who owns a client: its owner's account ID, or a muted `operator` for one
/// no account owns.
fn owner(owner: Option<UserId>) -> Cell {
owner.map_or_else(|| Cell::new("operator").style(Style::Muted), Cell::new)
}

/// A client's status, coloured: `deleted`, `suspended`, `disabled` or
/// `enabled`. Deletion comes first, then a suspension.
fn status(deleted: bool, suspended: bool, enabled: bool) -> Cell {
Expand Down Expand Up @@ -323,9 +329,7 @@ report!([Client], self, out, {
client.allow_refresh.into(),
client.trusted.into(),
client.require_pushed_authorization_requests.into(),
client
.owner_id
.map_or_else(|| Cell::new("operator").style(Style::Muted), Cell::new),
ClientCommand::owner(client.owner_id),
Cell::new(&client.display_name),
]
}),
Expand Down Expand Up @@ -353,12 +357,7 @@ report!(ClientDetails, self, out, {
client.enabled,
),
),
(
"Owner",
client
.owner_id
.map_or_else(|| Cell::new("operator").style(Style::Muted), Cell::new),
),
("Owner", ClientCommand::owner(client.owner_id)),
("Redirect URIs", list(&client.redirect_uris)),
("Post-logout URIs", list(&client.post_logout_uris)),
("Scopes", list(&client.allowed_scopes)),
Expand Down
19 changes: 2 additions & 17 deletions apps/auth-service/src/cli/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,24 +400,9 @@ report!(UserDetail, self, out, {
}),
)?;
out.section("Passkeys")?;
out.table(
["ID", "NAME"],
"No passkeys.",
self.passkeys
.iter()
.map(|passkey| [Cell::new(passkey.id), Cell::new(&passkey.friendly_name)]),
)?;
self.passkeys[..].human(out)?;
out.section("Linked identities")?;
out.table(
["PROVIDER", "EMAIL"],
"No linked identities.",
self.identities.iter().map(|identity| {
[
Cell::new(identity.provider),
identity.linked_email.as_deref().into(),
]
}),
)?;
self.identities[..].human(out)?;
out.section("Sessions")?;
out.table(
["ID", "METHODS", "SIGNED IN", "LAST SEEN", "EXPIRES"],
Expand Down