Skip to content

Implement server-wide open group user bans and unbans.#1772

Open
Bilb wants to merge 123 commits intodevfrom
dev-gravel
Open

Implement server-wide open group user bans and unbans.#1772
Bilb wants to merge 123 commits intodevfrom
dev-gravel

Conversation

@Bilb
Copy link
Collaborator

@Bilb Bilb commented Jan 13, 2026

PR made from https://codeberg.org/gravel/session-desktop

The PR has been cleaned and has server-wide features blocked behind a feature flag.

This needs those strings to be added to crowdin.

  serverUnbanUser: 'Unban User from Server',
  globalUserUnbanFailed: 'Unban failed! Are you a global admin/mod?',
  serverBanUser: 'Ban User from Server',
  serverBanUserAndDeleteAll: 'Ban from Server and Delete All',
  addUploadPermission: 'Allow sending attachments',
  clearUploadPermission: 'Remove attachment exception',
  userPermissionsChanged: 'Changed user permissions successfully',
  failedToChangeUserPermissions: 'Failed to change user permissions',
  globalUserBanFailed: 'Ban failed! Are you a global admin/mod?',
  communityChangePermissions: 'Edit Permissions',
  communityPermissionAccessDescription: 'Anyone can see the room (+a)',
  communityPermissionAccessEnable: 'Enable room visibility',
  communityPermissionReadDescription: 'Anyone can read messages (+r)',
  communityPermissionReadEnable: 'Enable reading',
  communityPermissionUploadDescription: 'Anyone can upload files (+u)',
  communityPermissionUploadEnable: 'Enable uploads',
  communityPermissionWriteDescription: 'Anyone can send messages (+w)',
  communityPermissionWriteEnable: 'Enable writing',
  communityChangePermissionsDescription: 'For compatibility reasons, we don\'t know which permissions were enabled to begin with, but you can set new values below regardless.',

For server wide deletions, we need to check the capabilities of the sogs
session-foundation/session-pysogs@fd231f8

My fork is somewhat documented at https://sessioncommunities.online/handbook/#additional-moderator-tools:

  • (message right click menu) The Allow sending attachments and Remove attachment exception options allow moderators to grant or revoke upload permissions for regular users.
  • (message/room nav right click menu) The Ban User from Server and Unban User from Server options allow global moderators to ban a user from all Communities on a given server.
  • (conversation options) The Edit Permissions submenu allows admins to set default permissions for a given Community.

My fork can set +u and =u on users, ban/unban users server-wide, and set +/-rwua on rooms.¹

It's not easy to merge, but the first one (upload permission) would be a priority.²

My implementation has issues:

  • Both options (+u and =u) are visible at the same time.
  • Users without +u can still attempt to upload (upstream issue).

These are fixable, but I don't have the in-depth knowledge. Namely:

  • Clients don't track user permissions.
  • Clients will let users upload the rooms regardless of permission.
  • No code path for replying to media messages without +u (thumbnail reupload).

For my fork, I had to write custom CI code for Woodpecker.
I would appreciate help with building my fork for Windows
... You could try mirroring it to GitHub and see if it builds.


Notes for global bans and room permission editing:

  • All of +rwua options are on by default when editing room permissions.
  • Non-global admins see global ban buttons.
  • Have to roll your own SOGS If you need "server ban and delete all".
  • I use some legacy UI code.

And the issues to fix before merging these:

  • Clients do fetch, but don't track room permissions.
  • Clients do fetch, but don't track self global mod status.
  • "Ban from Server and Delete All" is only supported on the dev branch of pysogs. Also, needs a marker in 'capabilities'.
  • My room permission submenu would need new UI code.

¹ Fork features: https://sessioncommunities.online/handbook/#additional-moderator-tools
² Upload permission support is lacking. Global bans are used just by a few people and admins use special commands for +w/-w; see https://codeberg.org/gravel/pysogs-sql-triggers.

ianmacd and others added 30 commits January 31, 2023 01:51
This adds to Session the ability to ban a user not just from a single
group, but from an entire SOGS.

To successfully ban (or unban) a user across a whole server, the
executor must be a global moderator of the SOGS instance.

When banning a user, the global moderator may opt to also remove all of
the user's messages from the server. This requires PySOGS > 0.3.7 to
allow the simultaneous deletion of messages from multiple groups. See
oxen-io/session-pysogs@2c8e4f1.

This has been tested with Session 1.10.4 in combination with
`open.getsession.org` and `sog.caliban.org`, both of which have been
updated to support server-wide banning.
New menu items are visible in Communities. One allows the target user to
upload attachment, while the other clears this permission. This only has
an effect in Communities where uploads are off, but the options are
still shown. Furthermore, both options are shown at the same time. These
limitations stem from the limited Open Group data model in the codebase.
jagerman pushed a commit to session-foundation/session-pysogs that referenced this pull request Jan 28, 2026
This change allows Session clients to check whether the SOGS supports
"Ban from Server and Delete All".

This is a follow-up to oxen-io#167, which added
server-wide message deletion capabilities. As this change has not been
released, few SOGS support this useful capability, and clients cannot
know in advance whether the deletion request will be honored.

Ideally, clients should let users know if this feature is not supported.
This may be required from the official Desktop client in
session-foundation/session-desktop#1772.
@Bilb Bilb force-pushed the dev branch 4 times, most recently from 9482711 to 0e508e6 Compare February 19, 2026 06:25
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

Comments