Merge pull request #2647 from matrix-org/luke/get-group-users-is-privileged

Return whether a user is an admin within a group
This commit is contained in:
Luke Barnard 2017-11-07 12:05:11 +00:00 committed by GitHub
commit 1bd654dabd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View file

@ -426,14 +426,15 @@ class GroupsServerHandler(object):
for user_result in user_results: for user_result in user_results:
g_user_id = user_result["user_id"] g_user_id = user_result["user_id"]
is_public = user_result["is_public"] is_public = user_result["is_public"]
is_privileged = user_result["is_admin"]
entry = {"user_id": g_user_id} entry = {"user_id": g_user_id}
profile = yield self.profile_handler.get_profile_from_cache(g_user_id) profile = yield self.profile_handler.get_profile_from_cache(g_user_id)
entry.update(profile) entry.update(profile)
if not is_public: entry["is_public"] = bool(is_public)
entry["is_public"] = False entry["is_privileged"] = bool(is_privileged)
if not self.is_mine_id(g_user_id): if not self.is_mine_id(g_user_id):
attestation = yield self.store.get_remote_attestation(group_id, g_user_id) attestation = yield self.store.get_remote_attestation(group_id, g_user_id)

View file

@ -54,7 +54,7 @@ class GroupServerStore(SQLBaseStore):
return self._simple_select_list( return self._simple_select_list(
table="group_users", table="group_users",
keyvalues=keyvalues, keyvalues=keyvalues,
retcols=("user_id", "is_public",), retcols=("user_id", "is_public", "is_admin",),
desc="get_users_in_group", desc="get_users_in_group",
) )