MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / get_users_from_db

Method get_users_from_db

web/setup.py:463–495  ·  view source on GitHub ↗

Get user(s) details.

(username: Optional[str] = None,
                          auth_source: AuthType = None,
                          console: Optional[bool] = True,
                          json: Optional[bool] = False,
                          )

Source from the content-addressed store, hash-verified

461 ManageUsers.get_users_from_db(username, auth_source, True, json)
462
463 def get_users_from_db(username: Optional[str] = None,
464 auth_source: AuthType = None,
465 console: Optional[bool] = True,
466 json: Optional[bool] = False,
467 ):
468 """Get user(s) details."""
469
470 app = create_app(config.APP_NAME + '-cli')
471 with app.test_request_context():
472 if username and auth_source:
473 users = User.query.filter_by(username=username,
474 auth_source=auth_source)
475 elif not username and auth_source:
476 users = User.query.filter_by(auth_source=auth_source)
477 elif username and not auth_source:
478 users = User.query.filter_by(username=username)
479 else:
480 users = User.query.all()
481 users_data = []
482 for u in users:
483 _data = {'id': u.id,
484 'username': u.username,
485 'email': u.email,
486 'active': u.active,
487 'role': u.roles[0].name,
488 'auth_source': u.auth_source,
489 'locked': u.locked
490 }
491 users_data.append(_data)
492 if console:
493 ManageUsers.display_user(users_data, console, json)
494 else:
495 return users_data
496
497 @app.command()
498 @update_sqlite_path

Callers 4

update_userMethod · 0.80
get_usersMethod · 0.80
update_external_userMethod · 0.80
create_userMethod · 0.80

Calls 3

create_appFunction · 0.90
appendMethod · 0.80
display_userMethod · 0.80

Tested by

no test coverage detected