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

Admin route for detecting if the user is an admin #6130

Closed
turt2live opened this issue Sep 27, 2019 · 12 comments
Closed

Admin route for detecting if the user is an admin #6130

turt2live opened this issue Sep 27, 2019 · 12 comments
Labels
z-p2 (Deprecated Label)

Comments

@turt2live
Copy link
Member

Currently software abuses /whois for checking admin state, though in some cases this is not useful because /whois will return a result if the requesting user is the target user. Some implementations get around this by querying a non-existent user to get an empty response if the requesting user is an admin.

A route to just check if the user's access token givens them admin powers would be great.

@t3chguy
Copy link
Member

t3chguy commented Sep 27, 2019

maybe /whois/ could simply be extended with an is_admin flag, would be useful for other admin tools surely?

@neilisfragile
Copy link
Contributor

An admin user is a very Synapse orientated concept and putting it in whois would mean adding the concept to the spec for all, I think this would be better housed under the Synapse specific admin namespace

@t3chguy
Copy link
Member

t3chguy commented Oct 10, 2019

Whois has a Synapse specific endpoint:
GET /_synapse/admin/v1/whois/<user_id>
which is what js-sdk uses

@turt2live
Copy link
Member Author

(also the spec is fine with adding more fields to responses, just have to be wary of those fields changing value in the spec)

@neilisfragile
Copy link
Contributor

Whois has a Synapse specific endpoint:
GET /_synapse/admin/v1/whois/<user_id>
which is what js-sdk uses

Though currently it requires that the caller is an admin, @turt2live I think you are asking for a non-admin endpoint?

@t3chguy
Copy link
Member

t3chguy commented Oct 11, 2019

I read through the code and it requires you to be an admin or be requesting the whois on yourself, which is the case is_admin is desired for

@turt2live
Copy link
Member Author

I am asking for a way to determine if the access token gives the user Synapse admin rights. Synapse has an if statement where if you /whois yourself, you can get your data (good), but that means we can't use that to determine admin state.

@richvdh
Copy link
Member

richvdh commented Oct 11, 2019

could you clarify the usecase here? Why do clients want to know if you are an admin?

@turt2live
Copy link
Member Author

So they can show a "Deactivate this user" button.

@richvdh
Copy link
Member

richvdh commented Oct 11, 2019

ok.

I'm not quite clear why #6180 was rejected and have reopened it. That said, I'm not sure it's a great solution to the problem.

@Harha
Copy link

Harha commented Oct 11, 2019

I'm new to the matrix spec and synapse as a whole, so I just did what was requested in my pull request.

Feel free to suggest better approaches and I'll see what I can do.

@turt2live
Copy link
Member Author

This was added in #5914

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-p2 (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

5 participants