stegololz commented on code in PR #74371:
URL: https://github.com/apache/airflow/pull/74371#discussion_r4257982176


##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/cli/commands.py:
##########
@@ -449,46 +657,43 @@ def _create_resources(client: KeycloakAdmin, client_uuid: 
str, *, teams: list[st
     print("Resources created successfully.")
 
 
-def _get_permissions_to_create(
-    client: KeycloakAdmin,
-    client_uuid: str,
+def _validate_required_authz_objects(
+    permission_configs: list[dict],
+    *,
+    scopes: list[dict],
+    resources: list[dict],
+) -> None:
+    """Validate that permission prerequisites exist."""
+    available_resources = {resource["name"] for resource in resources}
+    available_scopes = {scope["name"] for scope in scopes}
+
+    required_resources = {
+        name for permission in permission_configs for name in 
permission.get("resources", [])
+    }
+    required_scopes = {
+        name for permission in permission_configs for name in 
permission.get("scope_names", [])
+    }
+
+    missing_resources = required_resources - available_resources
+    missing_scopes = required_scopes - available_scopes
+
+    if missing_resources or missing_scopes:
+        raise ValueError(

Review Comment:
   nit: In team mode the missing resources are the team ones (Dag:<team>, 
etc.), so the hint could say `create-resources --teams <team>`. 
   As written, following it doesn't fix the error.



-- 
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]

Reply via email to