Skip to content

Add session endpoints - #626

Open
augustuswm wants to merge 9 commits into
mainfrom
new-session-endpoints
Open

augustuswm wants to merge 9 commits into
mainfrom
new-session-endpoints

Conversation

@augustuswm

@augustuswm augustuswm commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Adds two new endpoints:

  • List sessions for a user. This list includes expired sessions.
/// List existing sessions for a user.
#[endpoint {
    method = GET,
    path = "/api-user/{user_id}/session",
}]
  • Log out user. This marks all non-revoked sessions for a user as revoked.
/// Revoke all sessions for a user.
///
/// Returns an empty response on success.
#[endpoint {
    method = POST,
    path = "/api-user/{user_id}/logout",
}]

@augustuswm
augustuswm requested a review from notpeter October 16, 2026 09:13

@notpeter notpeter left a comment

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.

Would love to see a test for the two new functions (list/revoke).
But otherwise looks good.

Comment thread v-api/tests/endpoint_macros.rs
Comment thread v-api/src/context/user.rs
caller: &Caller<T>,
api_user: &TypedUuid<UserId>,
) -> ResourceResult<(), UserContextError> {
if caller.can(&VPermission::ManageApiUser(*api_user).into()) {

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.

Do we want to support users logging themselves out or only admins?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Eventually yes, but didn't want to hold this up on determining the required permission for it.

Comment thread v-model/src/storage/postgres.rs Outdated
Comment thread v-api/src/context/user.rs
Comment thread v-api/tests/endpoint_macros.rs Outdated
Comment thread v-api/tests/endpoint_macros.rs Outdated
Comment thread v-api/src/context/user.rs Outdated
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