Feature: Membership Management #13
Labels
No labels
area:api
area:core
area:docs
area:infra
area:ux
dependencies
documentation
duplicate
good first issue
help wanted
invalid
question
rust
status:complete
status:partial
status:planned
type:bug
type:design
type:feature
type:infra
type:refactor
type:research
type:ux
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
icub3d/decentcom#13
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Migrated from GitHub issue icub3d/decentcom#13
Original Author: @icub3d
Original Date: 2026-04-15T14:15:36Z
Feature: Membership Management
Overview
Membership management controls who is part of a server and how they got there. It implements the four membership modes (open, invite_only, allowlist, closed), provides kick and ban operations, and exposes a member list with role information. This is essential for server moderation and community management.
Background
The server model design doc (
docs/design/server-model.md) defines four membership modes and describes kick/ban operations. Bans are per-public-key. Since users are identified by Ed25519 keys, a banned user who generates a new key appears as a new account with no history, which is by design — operators can useallowlistorinvite_onlymode to mitigate ban evasion.This feature depends on roles (#11) for permission checks (
kick_members,ban_members) and invites (#12) for theinvite_onlyjoin path.Requirements
membership_modesetting:open,invite_only,allowlist,closedopenmode, any authenticated user can join by calling a join endpointinvite_onlymode, joining requires a valid invite (handled by invites feature)allowlistmode, only pre-approved public keys can join; admins manage the allowlistclosedmode, no new members can joinkick_memberspermission can kick a member (removes membership, user can rejoin)ban_memberspermission can ban a member by pubkey (removes membership, blocks rejoin)ban_memberspermission can unban a pubkeyDesign
API / Interface Changes
REST endpoints (all under
/api/v1/):/members/join/members/me/members/members/:pubkey/members/:pubkey/kickkick_members/members/:pubkey/banban_members/bans/:pubkeyban_members/bansban_members/allowlistmanage_server/allowlistmanage_server/allowlist/:pubkeymanage_serverPOST
/members/:pubkey/banrequest body:Gateway events:
MEMBER_JOIN— user joined the serverMEMBER_LEAVE— user left voluntarilyMEMBER_KICK— user was kickedMEMBER_BAN— user was bannedData Model Changes
Modified table: The existing
userstable already tracks membership. Amembersconcept may be a view or a separate table depending on Phase 1 implementation. Assuming amemberstable:Server config addition (in TOML):
Component Changes
Server (
server/):server/src/models/member.rs— Member, Ban, AllowlistEntry structsserver/src/store/member_store.rs—MemberStoretrait (list members, add/remove membership, bans, allowlist)server/src/store/sqlite/member_store.rs— SQLite implementationserver/src/routes/members.rs— REST handlers for membership operationsserver/src/routes/bans.rs— REST handlers for ban/unban/list bansserver/src/routes/allowlist.rs— REST handlers for allowlist managementserver/src/config.rs— Addmembership_modeto server configserver/src/middleware/permissions.rs— Add membership check (user must be a member for most endpoints)server/src/gateway/events.rs— New event types for membership changesClient (
client/):client/src/api/members.ts— API client functions for membership endpointsclient/src/stores/members.ts— Zustand slice for member list and bansclient/src/components/members/MemberList.tsx— Sidebar member list with role badges and online statusclient/src/components/members/MemberContextMenu.tsx— Right-click menu with kick/ban options (permission-gated)client/src/components/settings/BanList.tsx— View and manage banned usersclient/src/components/settings/AllowlistEditor.tsx— Manage allowlist entries (shown only in allowlist mode)client/src/components/settings/MembershipSettings.tsx— Toggle membership modeDatabase migrations:
server/migrations/NNNN_create_members.sqlserver/migrations/NNNN_create_bans.sqlserver/migrations/NNNN_create_allowlist.sqlTask List
Server
membership_modeto server config struct and TOML parsingMemberStoretrait to the storage trait hierarchymembers,bans, andallowlisttablesMemberStorefor the SQLite backend/members/joinwith membership mode enforcement (open: allow; invite_only: reject without invite; allowlist: check list; closed: reject)/members/me(voluntary leave)/membersand GET/members/:pubkey/members/:pubkey/kickwith permission and hierarchy checks/members/:pubkey/banwith permission and hierarchy checks; remove membership and add to bans table/bans/:pubkey(unban) and GET/bans/allowlist)MemberUserextractor)Client
Test List
registration_restricted_in_closed_mode)Implementation Notes
allowlistmembership mode allows users to create accounts (authenticate) but gates membership at the join endpoint. Onlyclosedmode fully blocks new account creation. This differs slightly from the original design which blocked registration for bothallowlistandclosed— the revised approach is simpler and lets users get a session token before they've been approved, which is needed for the allowlist flow.MemberUserextractor lives inserver/src/permissions.rsand wrapsUserPermissionswith a membership check.GET /members/:pubkeylooks up by public key (not user ID) since pubkeys are the user-visible identity.membership_modeis not implemented yet; mode changes still come from server config and restart.Open Questions