mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-12-25 23:19:25 -05:00
Publishing/removing from the directory requires a power level greater than canonical aliases.
This commit is contained in:
parent
509e381afa
commit
7936d2a96e
1
changelog.d/6965.feature
Normal file
1
changelog.d/6965.feature
Normal file
@ -0,0 +1 @@
|
|||||||
|
Publishing/removing a room from the room directory now requires the user to have a power level capable of modifying the canonical alias, instead of the room aliases.
|
@ -538,13 +538,13 @@ class Auth(object):
|
|||||||
return defer.succeed(auth_ids)
|
return defer.succeed(auth_ids)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def check_can_change_room_list(self, room_id, user):
|
def check_can_change_room_list(self, room_id: str, user: UserID):
|
||||||
"""Check if the user is allowed to edit the room's entry in the
|
"""Check if the user is allowed to edit the room's entry in the
|
||||||
published room list.
|
published room list.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
room_id (str)
|
room_id
|
||||||
user (UserID)
|
user
|
||||||
"""
|
"""
|
||||||
|
|
||||||
is_admin = yield self.is_server_admin(user)
|
is_admin = yield self.is_server_admin(user)
|
||||||
@ -556,7 +556,7 @@ class Auth(object):
|
|||||||
|
|
||||||
# We currently require the user is a "moderator" in the room. We do this
|
# We currently require the user is a "moderator" in the room. We do this
|
||||||
# by checking if they would (theoretically) be able to change the
|
# by checking if they would (theoretically) be able to change the
|
||||||
# m.room.aliases events
|
# m.room.canonical_alias events
|
||||||
power_level_event = yield self.state.get_current_state(
|
power_level_event = yield self.state.get_current_state(
|
||||||
room_id, EventTypes.PowerLevels, ""
|
room_id, EventTypes.PowerLevels, ""
|
||||||
)
|
)
|
||||||
@ -566,7 +566,7 @@ class Auth(object):
|
|||||||
auth_events[(EventTypes.PowerLevels, "")] = power_level_event
|
auth_events[(EventTypes.PowerLevels, "")] = power_level_event
|
||||||
|
|
||||||
send_level = event_auth.get_send_level(
|
send_level = event_auth.get_send_level(
|
||||||
EventTypes.Aliases, "", power_level_event
|
EventTypes.CanonicalAlias, "", power_level_event
|
||||||
)
|
)
|
||||||
user_level = event_auth.get_user_power_level(user_id, auth_events)
|
user_level = event_auth.get_user_power_level(user_id, auth_events)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user