mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-19 15:04:23 +01:00
1423 model filter bypass (#1451)
* Add `view=admin` GET param to `/api/v1/users`, `/api/v1/teams`, and `/api/v1/challenges` to bypass filtering for admins * Closes #1423 #1445 * Related to #1165
This commit is contained in:
@@ -31,7 +31,11 @@ users_namespace = Namespace("users", description="Endpoint to retrieve Users")
|
||||
class UserList(Resource):
|
||||
@check_account_visibility
|
||||
def get(self):
|
||||
users = Users.query.filter_by(banned=False, hidden=False)
|
||||
if is_admin() and request.args.get("view") == "admin":
|
||||
users = Users.query.filter_by()
|
||||
else:
|
||||
users = Users.query.filter_by(banned=False, hidden=False)
|
||||
|
||||
response = UserSchema(view="user", many=True).dump(users)
|
||||
|
||||
if response.errors:
|
||||
|
||||
Reference in New Issue
Block a user