Grant_Admin / Revoke_admin via API heeft herziening nodig

I’ve just tested this out on my own site. Revoking admin status via the API is done by making a PUT request to https://forum.yourdomain.com/admin/users/<user_id>/revoke_admin. When I try this, admin status is revoked and no email confirmation is required. I’m finding a couple of issues with the response that Discourse sends for this request though.

If the user does have admin status, I’m getting an empty response instead of a success message when I revoke their admin status via the API.

If the user does not have admin status, I get an HTML response if the PUT request is made to https://forum.yourdomain.com/admin/users/<user_id>/revoke_admin and an invalid access error if I make the request to https://forum.yourdomain.com/admin/users/<user_id>/revoke_admin.json.

It would be good to get informative success and failure messages for this route.

I’m not sure about allowing admin status to be granted without a confirmation email. The way it currently works is intended to supply an extra layer of security.

3 likes