MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / get_server_groups_for_user

Function get_server_groups_for_user

web/pgadmin/utils/server_access.py:95–119  ·  view source on GitHub ↗

Return server groups visible to the current user. Includes groups owned by the user plus groups containing shared servers (Server.shared=True, visible to all authenticated users). The Administrator role does not grant visibility into other users' private groups — admins see the sam

()

Source from the content-addressed store, hash-verified

93
94
95def get_server_groups_for_user():
96 """Return server groups visible to the current user.
97
98 Includes groups owned by the user plus groups containing shared
99 servers (Server.shared=True, visible to all authenticated users).
100
101 The Administrator role does not grant visibility into other
102 users' private groups — admins see the same set as a regular
103 user with the same ownership and sharing configuration.
104 """
105 if not config.SERVER_MODE:
106 return ServerGroup.query.filter_by(
107 user_id=current_user.id
108 ).all()
109
110 return ServerGroup.query.filter(
111 or_(
112 ServerGroup.user_id == current_user.id,
113 ServerGroup.id.in_(
114 db.session.query(Server.servergroup_id).filter(
115 Server.shared
116 )
117 )
118 )
119 ).all()
120
121
122def get_user_server_query():

Callers 2

get_all_server_groupsMethod · 0.90
get_new_connection_dataFunction · 0.90

Calls 1

filterMethod · 0.80

Tested by

no test coverage detected