Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

make_room_admin admin API should check if a user is in the room before sending a PL event on their behalf #9175

Closed
Half-Shot opened this issue Jan 20, 2021 · 3 comments
Labels
good first issue Good for newcomers S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. z-bug (Deprecated Label)

Comments

@Half-Shot
Copy link
Collaborator

Currently it will indiscriminately pull the first user out of the power_level list that has a high enough PL, but it's possible for that user to not be in the room. Given we already pull the membership to check if the requester is in the room, we should check this too.

@Half-Shot Half-Shot added the z-bug (Deprecated Label) label Jan 20, 2021
@y-pankaj
Copy link
Contributor

Hi! I would like to work on this issue.
As far as I get it, I should use room_state.get((EventTypes.Member, admin_user_id)) to check if the user is in the room and raise an error if the user not found below the line:

admin_user_id = admin_users[-1]

Also, what error should I raise?
if not admin_users:
raise SynapseError(400, "No local admin user in room")

I guess it should be similar to this with the error statement changed. Also, what should be the error statement raised.

@clokep
Copy link
Member

clokep commented Jan 25, 2021

@y-pankaj That seems reasonable. I think we would want to only raise that error if none of the users in the power_level list are able to be used.

@anoadragon453 anoadragon453 added good first issue Good for newcomers S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels Jan 26, 2021
@clokep
Copy link
Member

clokep commented Jan 27, 2021

I believe this is fixed by #9235.

@clokep clokep closed this as completed Jan 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. z-bug (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

4 participants