Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds an "Admin Panel" link to the user menu for qualified super-users:
Clicking on it takes the administrator to a page where they can list/edit users and export them to CSV:
It also provides functionality to get some (currently undocumented) statistics:
Implementation Notes
We use flask-admin for this.
We also need a way of tracking which users are admins and which aren't. For now we'll just use the
ADMIN_UI_USERS
config list for this, where each entry is the email of an admin user.This PR also adds a
is_admin()
method to theUser
model which essentially returns whether the user's email is inADMIN_UI_USERS
.Note that since we don't actually support email validation at present, admins will have to manually verify that the users associated with the emails in
ADMIN_UI_USERS
are actually who they claim to be.To further prevent against malicious attempts to poke at these endpoints,
ADMIN_UI_BASIC_AUTH
can optionally be set to a string of the form username:password and HTTP Basic Authentication will protect everything under/admin/
.