コード例 #1
0
ファイル: server.py プロジェクト: matrix-org/synapse
    def on_GET(self, origin, content, query):
        if self.deny_access:
            raise FederationDeniedError(origin)

        limit = parse_integer_from_args(query, "limit", 0)
        since_token = parse_string_from_args(query, "since", None)
        include_all_networks = parse_boolean_from_args(
            query, "include_all_networks", False
        )
        third_party_instance_id = parse_string_from_args(
            query, "third_party_instance_id", None
        )

        if include_all_networks:
            network_tuple = None
        elif third_party_instance_id:
            network_tuple = ThirdPartyInstanceID.from_string(third_party_instance_id)
        else:
            network_tuple = ThirdPartyInstanceID(None, None)

        data = yield self.handler.get_local_public_room_list(
            limit, since_token,
            network_tuple=network_tuple,
            from_federation=True,
        )
        defer.returnValue((200, data))
コード例 #2
0
ファイル: server.py プロジェクト: mebjas/synapse
 def on_GET(self, origin, content, query):
     limit = parse_integer_from_args(query, "limit", 0)
     since_token = parse_string_from_args(query, "since", None)
     data = yield self.room_list_handler.get_local_public_room_list(
         limit, since_token
     )
     defer.returnValue((200, data))
コード例 #3
0
ファイル: server.py プロジェクト: matrix-org/synapse
    def on_GET(self, origin, content, query, group_id, role_id):
        requester_user_id = parse_string_from_args(query, "requester_user_id")
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        resp = yield self.handler.get_group_role(
            group_id, requester_user_id, role_id
        )

        defer.returnValue((200, resp))
コード例 #4
0
ファイル: server.py プロジェクト: matrix-org/synapse
    def on_POST(self, origin, content, query, group_id, room_id, config_key):
        requester_user_id = parse_string_from_args(query, "requester_user_id")
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        result = yield self.groups_handler.update_room_in_group(
            group_id, requester_user_id, room_id, config_key, content,
        )

        defer.returnValue((200, result))
コード例 #5
0
ファイル: server.py プロジェクト: matrix-org/synapse
    def on_POST(self, origin, content, query, group_id, user_id):
        requester_user_id = parse_string_from_args(query, "requester_user_id")
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        new_content = yield self.handler.remove_user_from_group(
            group_id, user_id, requester_user_id, content,
        )

        defer.returnValue((200, new_content))
コード例 #6
0
ファイル: server.py プロジェクト: matrix-org/synapse
    def on_DELETE(self, origin, content, query, group_id, role_id):
        requester_user_id = parse_string_from_args(query, "requester_user_id")
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        if role_id == "":
            raise SynapseError(400, "role_id cannot be empty string")

        resp = yield self.handler.delete_group_role(
            group_id, requester_user_id, role_id,
        )

        defer.returnValue((200, resp))
コード例 #7
0
ファイル: server.py プロジェクト: matrix-org/synapse
    def on_POST(self, origin, content, query, group_id, category_id):
        requester_user_id = parse_string_from_args(query, "requester_user_id")
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        if category_id == "":
            raise SynapseError(400, "category_id cannot be empty string")

        resp = yield self.handler.upsert_group_category(
            group_id, requester_user_id, category_id, content,
        )

        defer.returnValue((200, resp))
コード例 #8
0
ファイル: server.py プロジェクト: simonzhangsm/synapse
    def on_POST(self, origin, content, query, group_id, role_id, user_id):
        requester_user_id = parse_string_from_args(query, "requester_user_id")
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        if role_id == "":
            raise SynapseError(400, "role_id cannot be empty string")

        resp = yield self.handler.update_group_summary_user(
            group_id,
            requester_user_id,
            user_id=user_id,
            role_id=role_id,
            content=content,
        )

        defer.returnValue((200, resp))
コード例 #9
0
ファイル: server.py プロジェクト: simonzhangsm/synapse
    def on_DELETE(self, origin, content, query, group_id, category_id,
                  room_id):
        requester_user_id = parse_string_from_args(query, "requester_user_id")
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        if category_id == "":
            raise SynapseError(400, "category_id cannot be empty string")

        resp = yield self.handler.delete_group_summary_room(
            group_id,
            requester_user_id,
            room_id=room_id,
            category_id=category_id,
        )

        defer.returnValue((200, resp))
コード例 #10
0
ファイル: groups_server.py プロジェクト: samuel-p/synapse
    async def on_GET(
        self,
        origin: str,
        content: Literal[None],
        query: Dict[bytes, List[bytes]],
        group_id: str,
    ) -> Tuple[int, JsonDict]:
        requester_user_id = parse_string_from_args(query,
                                                   "requester_user_id",
                                                   required=True)
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        new_content = await self.handler.get_group_summary(
            group_id, requester_user_id)

        return 200, new_content
コード例 #11
0
    async def on_POST(self, origin, content, query, group_id, category_id,
                      room_id):
        requester_user_id = parse_string_from_args(query, "requester_user_id")
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        if category_id == "":
            raise SynapseError(400, "category_id cannot be empty string")

        resp = await self.handler.update_group_summary_room(
            group_id,
            requester_user_id,
            room_id=room_id,
            category_id=category_id,
            content=content,
        )

        return 200, resp
コード例 #12
0
ファイル: groups_server.py プロジェクト: samuel-p/synapse
    async def on_POST(
        self,
        origin: str,
        content: JsonDict,
        query: Dict[bytes, List[bytes]],
        group_id: str,
        room_id: str,
        config_key: str,
    ) -> Tuple[int, JsonDict]:
        requester_user_id = parse_string_from_args(query,
                                                   "requester_user_id",
                                                   required=True)
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        result = await self.handler.update_room_in_group(
            group_id, requester_user_id, room_id, config_key, content)

        return 200, result
コード例 #13
0
ファイル: groups_server.py プロジェクト: samuel-p/synapse
    async def on_DELETE(
        self,
        origin: str,
        content: Literal[None],
        query: Dict[bytes, List[bytes]],
        group_id: str,
        role_id: str,
    ) -> Tuple[int, JsonDict]:
        requester_user_id = parse_string_from_args(query,
                                                   "requester_user_id",
                                                   required=True)
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        if role_id == "":
            raise SynapseError(400, "role_id cannot be empty string")

        resp = await self.handler.delete_group_role(group_id,
                                                    requester_user_id, role_id)

        return 200, resp
コード例 #14
0
ファイル: groups_server.py プロジェクト: samuel-p/synapse
    async def on_POST(
        self,
        origin: str,
        content: JsonDict,
        query: Dict[bytes, List[bytes]],
        group_id: str,
        category_id: str,
        room_id: str,
    ) -> Tuple[int, JsonDict]:
        requester_user_id = parse_string_from_args(query,
                                                   "requester_user_id",
                                                   required=True)
        if get_domain_from_id(requester_user_id) != origin:
            raise SynapseError(403, "requester_user_id doesn't match origin")

        if category_id == "":
            raise SynapseError(400, "category_id cannot be empty string",
                               Codes.INVALID_PARAM)

        if len(category_id) > MAX_GROUP_CATEGORYID_LENGTH:
            raise SynapseError(
                400,
                "category_id may not be longer than %s characters" %
                (MAX_GROUP_CATEGORYID_LENGTH, ),
                Codes.INVALID_PARAM,
            )

        resp = await self.handler.update_group_summary_room(
            group_id,
            requester_user_id,
            room_id=room_id,
            category_id=category_id,
            content=content,
        )

        return 200, resp
コード例 #15
0
ファイル: server.py プロジェクト: DoubleMalt/synapse
 def on_GET(self, origin, content, query, context):
     return self.handler.on_context_state_request(
         origin,
         context,
         parse_string_from_args(query, "event_id", None),
     )
コード例 #16
0
ファイル: server.py プロジェクト: matrix-org/synapse
 def on_GET(self, origin, content, query, room_id):
     return self.handler.on_state_ids_request(
         origin,
         room_id,
         parse_string_from_args(query, "event_id", None, required=True),
     )
コード例 #17
0
ファイル: server.py プロジェクト: xelivous/synapse
 def on_GET(self, origin, content, query, context):
     return self.handler.on_context_state_request(
         origin,
         context,
         parse_string_from_args(query, "event_id", None),
     )
コード例 #18
0
 async def on_GET(self, origin, content, query, room_id):
     return await self.handler.on_state_ids_request(
         origin,
         room_id,
         parse_string_from_args(query, "event_id", None, required=True),
     )