Allow group updates

This commit is contained in:
2025-06-01 16:16:15 +02:00
parent ba936ac645
commit ecad667521
5 changed files with 544 additions and 230 deletions

View File

@ -359,16 +359,26 @@ class AdminBackend:
self,
group_filter: str | None = None,
regex: bool = True,
flat: bool = False,
) -> ClientSecretGroupList:
"""Get secret groups.
The starting group can be filtered with the group_name argument, which
may be a regular expression.
Groups are returned in a tree, unless flat is True.
"""
all_secrets = await self.backend.get_detailed_secrets()
secrets_mapping = {secret.name: secret for secret in all_secrets}
with self.password_manager() as password_manager:
all_groups = password_manager.get_secret_groups(group_filter, regex=regex)
if flat:
all_groups = password_manager.get_secret_group_list(
group_filter, regex=regex
)
else:
all_groups = password_manager.get_secret_groups(
group_filter, regex=regex
)
ungrouped = password_manager.get_ungrouped_secrets()
group_result: list[ClientSecretGroup] = []