Skip to content

Commit

Permalink
Add user info rpc cmds
Browse files Browse the repository at this point in the history
  • Loading branch information
AureliaDolo committed Nov 4, 2024
1 parent 4d89609 commit b2a8640
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
[
{
"major_versions": [
4
],
"req": {
"cmd": "user_info",
"fields": [
{
"name": "user_ids",
"type": "List<UserID>"
}
]
},
"reps": [
{
"status": "ok",
"fields": [
{
"name": "user_info",
"type": "List<UserInfo>"
}
]
},
{
"status": "user_not_found",
"fields": [
{
"name": "not_found_user",
"type": "List<UserID>"
}
]
}
],
"nested_types": [
{
"name": "UserInfo",
"fields": [
{
"name": "user_id",
"type": "UserID"
},
{
"name": "human_handle",
"type": "InvitationToken"
},
{
"name": "frozen",
"type": "Boolean"
}
]
}
]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ from . import (
realm_unshare,
shamir_recovery_setup,
user_create,
user_info,
user_revoke,
user_update,
vlob_create,
Expand Down Expand Up @@ -69,6 +70,7 @@ class AnyCmdReq:
| realm_unshare.Req
| shamir_recovery_setup.Req
| user_create.Req
| user_info.Req
| user_revoke.Req
| user_update.Req
| vlob_create.Req
Expand Down Expand Up @@ -105,6 +107,7 @@ __all__ = [
"realm_unshare",
"shamir_recovery_setup",
"user_create",
"user_info",
"user_revoke",
"user_update",
"vlob_create",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS

# /!\ Autogenerated by misc/gen_protocol_typings.py, any modification will be lost !

from __future__ import annotations

from parsec._parsec import InvitationToken, UserID

class UserInfo:
def __init__(self, user_id: UserID, human_handle: InvitationToken, frozen: bool) -> None: ...
@property
def frozen(self) -> bool: ...
@property
def human_handle(self) -> InvitationToken: ...
@property
def user_id(self) -> UserID: ...

class Req:
def __init__(self, user_ids: list[UserID]) -> None: ...
def dump(self) -> bytes: ...
@property
def user_ids(self) -> list[UserID]: ...

class Rep:
@staticmethod
def load(raw: bytes) -> Rep: ...
def dump(self) -> bytes: ...

class RepUnknownStatus(Rep):
def __init__(self, status: str, reason: str | None) -> None: ...
@property
def status(self) -> str: ...
@property
def reason(self) -> str | None: ...

class RepOk(Rep):
def __init__(self, user_info: list[UserInfo]) -> None: ...
@property
def user_info(self) -> list[UserInfo]: ...

class RepUserNotFound(Rep):
def __init__(self, not_found_user: list[UserID]) -> None: ...
@property
def not_found_user(self) -> list[UserID]: ...
6 changes: 6 additions & 0 deletions server/parsec/components/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,3 +698,9 @@ async def api_tos_accept(
return tos_cmds.latest.tos_accept.RepNoTos()
case UserAcceptTosBadOutcome.TOS_MISMATCH:
return tos_cmds.latest.tos_accept.RepTosMismatch()

@api
async def api_get_user_info(
self, client_ctx: AuthenticatedClientContext, req: authenticated_cmds.latest.user_info.Req
) -> authenticated_cmds.latest.user_info.Rep:
pass
5 changes: 5 additions & 0 deletions server/tests/common/rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@ async def user_create(
raw_rep = await self._do_request(req.dump(), "authenticated")
return authenticated_cmds.latest.user_create.Rep.load(raw_rep)

async def user_info(self, user_ids: list[UserID]) -> authenticated_cmds.latest.user_info.Rep:
req = authenticated_cmds.latest.user_info.Req(user_ids=user_ids)
raw_rep = await self._do_request(req.dump(), "authenticated")
return authenticated_cmds.latest.user_info.Rep.load(raw_rep)

async def user_revoke(
self, revoked_user_certificate: bytes
) -> authenticated_cmds.latest.user_revoke.Rep:
Expand Down

0 comments on commit b2a8640

Please sign in to comment.