MCPcopy Create free account
hub / github.com/tiny-pilot/tinypilot / users_get

Function users_get

app/api.py:362–388  ·  view source on GitHub ↗

Lists all known users and indicates the currently logged-in user. Returns: On success, a JSON data structure with the following properties: users: array of objects containing usernames and roles (as strings). currentUsername: The username (as string) of the currently log

()

Source from the content-addressed store, hash-verified

360@api_blueprint.route('/users', methods=['GET'])
361@required_auth(auth.Role.ADMIN)
362def users_get():
363 """Lists all known users and indicates the currently logged-in user.
364
365 Returns:
366 On success, a JSON data structure with the following properties:
367 users: array of objects containing usernames and roles (as strings).
368 currentUsername: The username (as string) of the currently logged-in
369 user or null if not logged in.
370
371 Example:
372 {
373 "users": [{
374 "username": "little-hamster",
375 "role": "ADMIN"
376 }],
377 "currentUsername": "little-hamster"
378 }
379
380 Returns error object on failure.
381 """
382 return json_response.success({
383 'users': [{
384 'username': u.username,
385 'role': u.role.name,
386 } for u in auth.get_all_accounts()],
387 'currentUsername': session.get_username(),
388 })
389
390
391@api_blueprint.route('/users', methods=['DELETE'])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected