synapse/api/auth.py
def check_can_change_room_list(self, room_id, user):
        """Check if the user is allowed to edit the room's entry in the
        published room list.

        Args:
            room_id (str)
            user (UserID)
        """

        is_admin = yield self.is_server_admin(user)
        if is_admin:
            defer.returnValue(True)

        user_id = user.to_string()
        yield self.check_joined_room(room_id, user_id)

        # 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
        # m.room.aliases events
        power_level_event = yield self.state.get_current_state(
            room_id, EventTypes.PowerLevels, ""
        )

        auth_events = {}
        if power_level_event:
            auth_events[(EventTypes.PowerLevels, "")] = power_level_event

        send_level = event_auth.get_send_level(
            EventTypes.Aliases, "", auth_events
        )
        user_level = event_auth.get_user_power_level(user_id, auth_events)

        if user_level < send_level:
            raise AuthError(
                403,
                "This server requires you to be a moderator in the room to"
                " edit its room list entry"
            )
Check if the user is allowed to edit the room's entry in the
        published room list.

        Args:
            room_id (str)
            user (UserID)
        
Check if the user is allowed to edit the room's entry in the
published room list.


Check if the user is allowed to edit the room ' s entry in the published room list .
def check_can_change_room_list(self, room_id, user):
        is_admin = yield self.is_server_admin(user)
        if is_admin:
            defer.returnValue(True)
        user_id = user.to_string()
        yield self.check_joined_room(room_id, user_id)
        power_level_event = yield self.state.get_current_state(
            room_id, EventTypes.PowerLevels, ""
        )
        auth_events = {}
        if power_level_event:
            auth_events[(EventTypes.PowerLevels, "")] = power_level_event
        send_level = event_auth.get_send_level(
            EventTypes.Aliases, "", auth_events
        )
        user_level = event_auth.get_user_power_level(user_id, auth_events)
        if user_level < send_level:
            raise AuthError(
                403,
                "This server requires you to be a moderator in the room to"
                " edit its room list entry"
            )
def check_can_change_room_list ( self , room_id , user ) : is_admin = yield self . is_server_admin ( user ) if is_admin : defer . returnValue ( True ) user_id = user . to_string ( ) yield self . check_joined_room ( room_id , user_id ) power_level_event = yield self . state . get_current_state ( room_id , EventTypes . PowerLevels , "" ) auth_events = { } if power_level_event : auth_events [ ( EventTypes . PowerLevels , "" ) ] = power_level_event send_level = event_auth . get_send_level ( EventTypes . Aliases , "" , auth_events ) user_level = event_auth . get_user_power_level ( user_id , auth_events ) if user_level < send_level : raise AuthError ( 403 , "This server requires you to be a moderator in the room to" " edit its room list entry" )
Check if the user is allowed to edit the room's entry in the
published room list.
Check if the user is allowed to edit the room ' s entry in the published room list .
"""Check if the user is allowed to edit the room's entry in the
        published room list.

        Args:
            room_id (str)
            user (UserID)
        """ # 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 # m.room.aliases events
self
room_id
user