Skip to content

Default KC groups adjustment #115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.6.0
current_version = 1.6.1
commit = False
tag = False

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "rasenmaeher_api"
version = "1.6.0"
version = "1.6.1"
description = "python-rasenmaeher-api"
authors = [
"Aciid <703382+Aciid@users.noreply.github.com>",
Expand Down
2 changes: 1 addition & 1 deletion src/rasenmaeher_api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
""" python-rasenmaeher-api """
__version__ = "1.6.0" # NOTE Use `bump2version --config-file patch` to bump versions correctly
__version__ = "1.6.1" # NOTE Use `bump2version --config-file patch` to bump versions correctly
20 changes: 11 additions & 9 deletions src/rasenmaeher_api/kchelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,16 @@ async def ensure_product_groups(self) -> Optional[bool]:
subgroups_by_name: Dict[str, Dict[str, Any]] = {
subgroup["name"]: subgroup for subgroup in group["subGroups"]
}
subgrpname = f"{productname}_dflt"
if subgrpname not in subgroups_by_name:
LOGGER.info("Creating KC group /{}/{}".format(productname, subgrpname))
new_id = await self.kcadmin.a_create_group({"name": subgrpname}, parent=group["id"])
subgroups_by_name[subgrpname] = await self.kcadmin.a_get_group(new_id)
created = True
if self._product_initial_grps is None:
self._product_initial_grps = {}
self._product_initial_grps[productname] = subgroups_by_name[subgrpname]
for suffix in ("default", "admins"):
subgrpname = f"{productname}_{suffix}"
if subgrpname not in subgroups_by_name:
LOGGER.info("Creating KC group /{}/{}".format(productname, subgrpname))
new_id = await self.kcadmin.a_create_group({"name": subgrpname}, parent=group["id"])
subgroups_by_name[subgrpname] = await self.kcadmin.a_get_group(new_id)
created = True
if self._product_initial_grps is None:
self._product_initial_grps = {}
if suffix == "default":
self._product_initial_grps[productname] = subgroups_by_name[subgrpname]
LOGGER.debug("Product initial KC groups: {}".format(self._product_initial_grps))
return created
2 changes: 1 addition & 1 deletion tests/test_rasenmaeher_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

def test_version() -> None:
"""Make sure version matches expected"""
assert __version__ == "1.6.0"
assert __version__ == "1.6.1"


@pytest.mark.asyncio(loop_scope="session")
Expand Down