Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Remove user-visible groups/communities code (#12553)
Browse files Browse the repository at this point in the history
Makes it so that groups/communities no longer exist from a user-POV. E.g. we remove:

* All API endpoints (including Client-Server, Server-Server, and admin).
* Documented configuration options (and the experimental flag, which is now unused).
* Special handling during room upgrades.
* The `groups` section of the `/sync` response.
  • Loading branch information
clokep committed May 25, 2022
1 parent 759f9c0 commit a8db8c6
Show file tree
Hide file tree
Showing 19 changed files with 3 additions and 2,217 deletions.
1 change: 1 addition & 0 deletions changelog.d/12553.removal
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Remove support for the non-standard groups/communities feature from Synapse.
10 changes: 0 additions & 10 deletions docs/sample_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2521,16 +2521,6 @@ push:
# "events_default": 1


# Uncomment to allow non-server-admin users to create groups on this server
#
#enable_group_creation: true

# If enabled, non server admins can only create groups with local parts
# starting with this prefix
#
#group_creation_prefix: "unofficial_"



# User Directory configuration
#
Expand Down
19 changes: 0 additions & 19 deletions docs/usage/configuration/config_documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3145,25 +3145,6 @@ Example configuration:
encryption_enabled_by_default_for_room_type: invite
```
---
Config option: `enable_group_creation`

Set to true to allow non-server-admin users to create groups on this server

Example configuration:
```yaml
enable_group_creation: true
```
---
Config option: `group_creation_prefix`

If enabled/present, non-server admins can only create groups with local parts
starting with this prefix.

Example configuration:
```yaml
group_creation_prefix: "unofficial_"
```
---
Config option: `user_directory`

This setting defines options related to the user directory.
Expand Down
5 changes: 0 additions & 5 deletions synapse/api/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
# the maximum length for a user id is 255 characters
MAX_USERID_LENGTH = 255

# The maximum length for a group id is 255 characters
MAX_GROUPID_LENGTH = 255
MAX_GROUP_CATEGORYID_LENGTH = 255
MAX_GROUP_ROLEID_LENGTH = 255


class Membership:

Expand Down
4 changes: 0 additions & 4 deletions synapse/app/generic_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
from synapse.rest.client import (
account_data,
events,
groups,
initial_sync,
login,
presence,
Expand Down Expand Up @@ -323,9 +322,6 @@ def _listen_http(self, listener_config: ListenerConfig) -> None:

presence.register_servlets(self, resource)

if self.config.experimental.groups_enabled:
groups.register_servlets(self, resource)

resources.update({CLIENT_API_PREFIX: resource})

resources.update(build_synapse_client_resource_tree(self))
Expand Down
3 changes: 0 additions & 3 deletions synapse/config/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
# MSC3720 (Account status endpoint)
self.msc3720_enabled: bool = experimental.get("msc3720_enabled", False)

# The deprecated groups feature.
self.groups_enabled: bool = experimental.get("groups_enabled", False)

# MSC2654: Unread counts
self.msc2654_enabled: bool = experimental.get("msc2654_enabled", False)

Expand Down
12 changes: 0 additions & 12 deletions synapse/config/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,3 @@ class GroupsConfig(Config):
def read_config(self, config: JsonDict, **kwargs: Any) -> None:
self.enable_group_creation = config.get("enable_group_creation", False)
self.group_creation_prefix = config.get("group_creation_prefix", "")

def generate_config_section(self, **kwargs: Any) -> str:
return """\
# Uncomment to allow non-server-admin users to create groups on this server
#
#enable_group_creation: true
# If enabled, non server admins can only create groups with local parts
# starting with this prefix
#
#group_creation_prefix: "unofficial_"
"""
48 changes: 1 addition & 47 deletions synapse/federation/transport/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
FederationAccountStatusServlet,
FederationTimestampLookupServlet,
)
from synapse.federation.transport.server.groups_local import GROUP_LOCAL_SERVLET_CLASSES
from synapse.federation.transport.server.groups_server import (
GROUP_SERVER_SERVLET_CLASSES,
)
from synapse.http.server import HttpServer, JsonResource
from synapse.http.servlet import (
parse_boolean_from_args,
Expand Down Expand Up @@ -199,38 +195,6 @@ async def on_POST(
return 200, data


class FederationGroupsRenewAttestaionServlet(BaseFederationServlet):
"""A group or user's server renews their attestation"""

PATH = "/groups/(?P<group_id>[^/]*)/renew_attestation/(?P<user_id>[^/]*)"

def __init__(
self,
hs: "HomeServer",
authenticator: Authenticator,
ratelimiter: FederationRateLimiter,
server_name: str,
):
super().__init__(hs, authenticator, ratelimiter, server_name)
self.handler = hs.get_groups_attestation_renewer()

async def on_POST(
self,
origin: str,
content: JsonDict,
query: Dict[bytes, List[bytes]],
group_id: str,
user_id: str,
) -> Tuple[int, JsonDict]:
# We don't need to check auth here as we check the attestation signatures

new_content = await self.handler.on_renew_attestation(
group_id, user_id, content
)

return 200, new_content


class OpenIdUserInfo(BaseFederationServlet):
"""
Exchange a bearer token for information about a user.
Expand Down Expand Up @@ -292,16 +256,9 @@ async def on_GET(
SERVLET_GROUPS: Dict[str, Iterable[Type[BaseFederationServlet]]] = {
"federation": FEDERATION_SERVLET_CLASSES,
"room_list": (PublicRoomList,),
"group_server": GROUP_SERVER_SERVLET_CLASSES,
"group_local": GROUP_LOCAL_SERVLET_CLASSES,
"group_attestation": (FederationGroupsRenewAttestaionServlet,),
"openid": (OpenIdUserInfo,),
}

DEFAULT_SERVLET_GROUPS = ("federation", "room_list", "openid")

GROUP_SERVLET_GROUPS = ("group_server", "group_local", "group_attestation")


def register_servlets(
hs: "HomeServer",
Expand All @@ -324,10 +281,7 @@ def register_servlets(
Defaults to ``DEFAULT_SERVLET_GROUPS``.
"""
if not servlet_groups:
servlet_groups = DEFAULT_SERVLET_GROUPS
# Only allow the groups servlets if the deprecated groups feature is enabled.
if hs.config.experimental.groups_enabled:
servlet_groups = servlet_groups + GROUP_SERVLET_GROUPS
servlet_groups = SERVLET_GROUPS.keys()

for servlet_group in servlet_groups:
# Skip unknown servlet groups.
Expand Down
115 changes: 0 additions & 115 deletions synapse/federation/transport/server/groups_local.py

This file was deleted.

Loading

0 comments on commit a8db8c6

Please sign in to comment.