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