1
0
mirror of https://github.com/dkmstr/openuds.git synced 2025-01-03 01:17:56 +03:00

Fixed group manager not yielding groups after refactoring :S

This commit is contained in:
Adolfo Gómez García 2024-10-15 22:58:58 +02:00
parent 9641776ce1
commit e1c68f3895
No known key found for this signature in database
GPG Key ID: DD1ABF20724CDA23
2 changed files with 8 additions and 4 deletions

View File

@ -130,7 +130,11 @@ class GroupsManager:
"""Returns the list of valid groups for this groups manager."""
from uds.models import Group as DBGroup # Avoid circular imports
valid_id_list: list[int] = [grp.group.db_obj().id for grp in self._groups if grp.is_valid]
valid_id_list: list[int] = []
for grp in self._groups:
if grp.is_valid:
yield grp.group
valid_id_list.append(grp.group.db_obj().id)
# Now, get metagroups and also return them
for db_group in DBGroup.objects.filter(manager__id=self._db_auth.id, is_meta=True):

View File

@ -318,7 +318,7 @@ class ServicePool(UUIDModel, TaggingMixin):
and not self.is_restrained()
)
def when_will_be_replaced(self, is_for_user: 'User') -> typing.Optional[datetime]:
def when_will_be_replaced(self, for_user: 'User') -> typing.Optional[datetime]:
active_publication: typing.Optional['ServicePoolPublication'] = self.active_publication()
# If no publication or current revision, it's not going to be replaced
if active_publication is None:
@ -331,7 +331,7 @@ class ServicePool(UUIDModel, TaggingMixin):
# Return the date
try:
found = self.assigned_user_services().filter(
user=is_for_user, state__in=types.states.State.VALID_STATES
user=for_user, state__in=types.states.State.VALID_STATES
)[
0
] # Raises exception if at least one is not found