mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
Comments
This commit is contained in:
parent
6322fbbd41
commit
0aac30d53b
@ -38,7 +38,7 @@ class GroupAttestationSigning(object):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def verify_attestation(self, attestation, group_id, user_id, server_name=None):
|
def verify_attestation(self, attestation, group_id, user_id, server_name=None):
|
||||||
"""Verifies that the given attestation matches the given paramaters.
|
"""Verifies that the given attestation matches the given parameters.
|
||||||
|
|
||||||
An optional server_name can be supplied to explicitly set which server's
|
An optional server_name can be supplied to explicitly set which server's
|
||||||
signature is expected. Otherwise assumes that either the group_id or user_id
|
signature is expected. Otherwise assumes that either the group_id or user_id
|
||||||
@ -51,7 +51,7 @@ class GroupAttestationSigning(object):
|
|||||||
elif get_domain_from_id(user_id) == self.server_name:
|
elif get_domain_from_id(user_id) == self.server_name:
|
||||||
server_name = get_domain_from_id(group_id)
|
server_name = get_domain_from_id(group_id)
|
||||||
else:
|
else:
|
||||||
raise Exception("Expected eitehr group_id or user_id to be local")
|
raise Exception("Expected either group_id or user_id to be local")
|
||||||
|
|
||||||
if user_id != attestation["user_id"]:
|
if user_id != attestation["user_id"]:
|
||||||
raise SynapseError(400, "Attestation has incorrect user_id")
|
raise SynapseError(400, "Attestation has incorrect user_id")
|
||||||
|
@ -80,7 +80,9 @@ class GroupsServerHandler(object):
|
|||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_users_in_group(self, group_id, requester_user_id):
|
def get_users_in_group(self, group_id, requester_user_id):
|
||||||
"""Get the users in group as seen by requester_user_id
|
"""Get the users in group as seen by requester_user_id.
|
||||||
|
|
||||||
|
The ordering is arbitrary at the moment
|
||||||
"""
|
"""
|
||||||
|
|
||||||
yield self.check_group_is_ours(group_id, and_exists=True)
|
yield self.check_group_is_ours(group_id, and_exists=True)
|
||||||
@ -126,6 +128,8 @@ class GroupsServerHandler(object):
|
|||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_rooms_in_group(self, group_id, requester_user_id):
|
def get_rooms_in_group(self, group_id, requester_user_id):
|
||||||
"""Get the rooms in group as seen by requester_user_id
|
"""Get the rooms in group as seen by requester_user_id
|
||||||
|
|
||||||
|
This returns rooms in order of decreasing number of joined users
|
||||||
"""
|
"""
|
||||||
|
|
||||||
yield self.check_group_is_ours(group_id, and_exists=True)
|
yield self.check_group_is_ours(group_id, and_exists=True)
|
||||||
|
@ -28,7 +28,7 @@ CREATE UNIQUE INDEX groups_idx ON groups(group_id);
|
|||||||
CREATE TABLE group_users (
|
CREATE TABLE group_users (
|
||||||
group_id TEXT NOT NULL,
|
group_id TEXT NOT NULL,
|
||||||
user_id TEXT NOT NULL,
|
user_id TEXT NOT NULL,
|
||||||
is_admin BOOLEAN NOT NULL,
|
is_admin BOOLEAN NOT NULL, -- whether the users membership can be seen by everyone
|
||||||
is_public BOOLEAN NOT NULL
|
is_public BOOLEAN NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ CREATE INDEX groups_invites_u_idx ON group_invites(user_id);
|
|||||||
CREATE TABLE group_rooms (
|
CREATE TABLE group_rooms (
|
||||||
group_id TEXT NOT NULL,
|
group_id TEXT NOT NULL,
|
||||||
room_id TEXT NOT NULL,
|
room_id TEXT NOT NULL,
|
||||||
is_public BOOLEAN NOT NULL
|
is_public BOOLEAN NOT NULL -- whether the room can be seen by everyone
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE INDEX groups_rooms_g_idx ON group_rooms(group_id, room_id);
|
CREATE INDEX groups_rooms_g_idx ON group_rooms(group_id, room_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user