mirror of
https://github.com/Ysurac/openmptcprouter-vps-admin.git
synced 2025-03-09 15:40:05 +00:00
Add SOF-67: Returning total number of users by Dillon Ward
This commit is contained in:
parent
b0d2f8126c
commit
f9d5fc750c
2 changed files with 15 additions and 0 deletions
|
@ -3284,6 +3284,15 @@ async def list_users(current_user: User = Depends(get_current_user)):
|
|||
content = json.load(f)
|
||||
return content['users'][0]
|
||||
|
||||
@app.get('/get-number-of-users', summary="Get the total number of users")
|
||||
def get_number_of_users(current_user: User = Depends(get_current_user)):
|
||||
if not current_user.permissions == "admin":
|
||||
return {'result': 'permission', 'reason': 'Need admin user', 'route': 'get-number-of-users'}
|
||||
with open('/etc/openmptcprouter-vps-admin/omr-admin-config.json') as f:
|
||||
content = json.load(f)
|
||||
users = len(content['users'][0]) - 1
|
||||
return {'users': users}
|
||||
|
||||
@app.get('/speedtest', summary="Test speed from the server")
|
||||
async def speedtest(current_user: User = Depends(get_current_user)):
|
||||
return FileResponse('/usr/share/omr-server/speedtest/test.img')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue