Skip to content

Commit b617d4c

Browse files
Allow fetching service pools regardless of visibility
Adds an option to include non-visible service pools when retrieving them for groups, improving flexibility for administrative or backend operations where hidden pools may need to be accessed.
1 parent c86f0f5 commit b617d4c

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

server/src/uds/REST/methods/users_groups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def get_groups_from_metagroup(groups: collections.abc.Iterable[Group]) -> collec
7171
def get_service_pools_for_groups(
7272
groups: collections.abc.Iterable[Group],
7373
) -> collections.abc.Iterable[ServicePool]:
74-
for servicepool in ServicePool.get_pools_for_groups(groups):
74+
for servicepool in ServicePool.get_pools_for_groups(groups, visible_only=False):
7575
yield servicepool
7676

7777

server/src/uds/models/service_pool.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def validate_user(self, user: 'User') -> None:
558558

559559
@staticmethod
560560
def get_pools_for_groups(
561-
groups: collections.abc.Iterable['Group'], user: typing.Optional['User'] = None
561+
groups: collections.abc.Iterable['Group'], user: typing.Optional['User'] = None, *, visible_only: bool = True
562562
) -> collections.abc.Iterable['ServicePool']:
563563
"""
564564
Return deployed services with publications for the groups requested.
@@ -574,13 +574,14 @@ def get_pools_for_groups(
574574
services_not_needing_publication = [
575575
t.mod_type() for t in services.factory().services_not_needing_publication()
576576
]
577+
visible_kwargs = { 'visible': True } if visible_only else {}
577578
# Get services that HAS publications
578579
query = (
579580
ServicePool.objects.filter(
580581
assignedGroups__in=groups,
581582
assignedGroups__state=types.states.State.ACTIVE,
582583
state__in=types.states.State.PROCESABLE_STATES,
583-
visible=True,
584+
**visible_kwargs,
584585
)
585586
.annotate(
586587
pubs_active=models.Count(

0 commit comments

Comments
 (0)