vincbeck commented on code in PR #74371:
URL: https://github.com/apache/airflow/pull/74371#discussion_r4741882669
##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/cli/commands.py:
##########
@@ -1258,9 +1582,20 @@ def _attach_policy_to_scope_permission(
resource_names: list[str],
decision_strategy: str = "UNANIMOUS",
_dry_run: bool = False,
+ authz_settings: dict | None = None,
) -> None:
if _dry_run:
- print(f"Would attach policy '{policy_name}' to permission
'{permission_name}'.")
+ if authz_settings is None:
+ authz_settings =
client.get_client_authz_settings(client_id=client_uuid)
+ _preview_permission_update(
Review Comment:
nit: `create-team --dry-run` prints the same "Would configure permission
..." line once per role, since each attach call previews against the same
snapshot. Example: on a new team, the `ReadOnly-<team>` line shows 4 times and
the `GlobalList` one 5 times.
##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/cli/commands.py:
##########
@@ -383,6 +512,45 @@ def _create_scopes(client: KeycloakAdmin, client_uuid:
str, *, _dry_run: bool =
print("Scopes created successfully.")
+def _get_resource_names_to_create(
+ teams: list[str],
+) -> tuple[list[str], list[str]]:
+ """Build standard and menu resource names without querying Keycloak."""
+ standard_names = [resource.value for resource in KeycloakResource]
+ existing = set(standard_names)
+
+ for team in teams:
+ for resource_name in TEAM_SCOPED_RESOURCE_NAMES:
+ name = f"{resource_name}:{team}"
+ if name not in existing:
+ standard_names.append(name)
+ existing.add(name)
+
+ menu_names = [item.value for item in MenuItem]
+ return standard_names, menu_names
+
+
+def _validate_permission_creation_plan(
Review Comment:
The resources here are built from the same constants as
`_get_permission_configs`, so only the scope check can fail. Can we just check
the scopes in `create_team_command` then?
##########
providers/keycloak/docs/changelog.rst:
##########
@@ -166,14 +187,18 @@ Bug Fixes
.....
.. note::
- Upgrading the provider does not update existing Keycloak permissions. For
each existing team,
+ In version 0.9.0, upgrading the provider did not update existing Keycloak
permissions.
Review Comment:
nit: I would not modify the note of a released version. The new note at the
top already explains the current behavior.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]