aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-hub/src/meshbay_hub/api/groups.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-hub/src/meshbay_hub/api/groups.py')
-rw-r--r--packages/meshbay-hub/src/meshbay_hub/api/groups.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/packages/meshbay-hub/src/meshbay_hub/api/groups.py b/packages/meshbay-hub/src/meshbay_hub/api/groups.py
index b903fcf..72ba194 100644
--- a/packages/meshbay-hub/src/meshbay_hub/api/groups.py
+++ b/packages/meshbay-hub/src/meshbay_hub/api/groups.py
@@ -124,7 +124,19 @@ async def group_online_nodes(
# But when the hub has public groups switched off, an existing one keeps
# working only for the people already in it: no non-member gets handed a
# node to connect to. Members always have a row here, so they are unaffected.
- if group.visibility == "public" and not await hub_settings.public_groups_allowed(db):
+ #
+ # A **private** group hands its node list to members and to nobody else. It
+ # used to answer any authenticated account that knew the id — which an
+ # ex-member knows for ever — with the ids and public keys of the machines
+ # hosting it. That is the "registered hub user with no membership" of §2.1
+ # reaching an endpoint that did not check membership, and §7.4 already
+ # states the property for the public case: a non-member is handed no node.
+ #
+ # Nothing legitimate needs this before joining. An open join writes the
+ # membership row first (`POST /{id}/join`), and an invitation registers the
+ # invitee's membership when the code is created — so by the time either asks
+ # for a node, the row exists.
+ if group.visibility != "public" or not await hub_settings.public_groups_allowed(db):
if not await db.get(GroupMember, (group_id, current_user.id)):
raise HTTPException(status_code=403, detail="Not a member of this group")