From 860843f5175e1edaeb3d7897ce931f6edd62c457 Mon Sep 17 00:00:00 2001 From: Colin James Date: Fri, 22 Nov 2024 09:26:09 +0000 Subject: [PATCH] CA-402654: Partially revert 3e2e970af A module binding appeared to be unused but was being evaluated for its effect alone. We reintroduce it here and don't bind a name. Signed-off-by: Colin James --- ocaml/xapi/rbac.ml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ocaml/xapi/rbac.ml b/ocaml/xapi/rbac.ml index 2b311a7e56..2a8555cc9a 100644 --- a/ocaml/xapi/rbac.ml +++ b/ocaml/xapi/rbac.ml @@ -243,6 +243,12 @@ let assert_permission_name ~__context ~permission = let assert_permission ~__context ~permission = assert_permission_name ~__context ~permission:permission.role_name_label +(* Populates assert_permission_fn on behalf of TaskHelper to + avoid a dependency cycle. *) +let () = + if !TaskHelper.rbac_assert_permission_fn = None then + TaskHelper.rbac_assert_permission_fn := Some assert_permission + let has_permission_name ~__context ~permission = let session_id = get_session_of_context ~__context ~permission in is_access_allowed ~__context ~session_id ~permission