Skip to content

Commit 3ad8452

Browse files
committed
rabbit_vhost: Move with_user_and_vhost/3 from rabbit_misc in rabbitmq-common
This is a breaking change and we'll need to update users of this API. This resolves a dependency of rabbitmq-common on rabbitmq-server. [#118490793]
1 parent ef5fc31 commit 3ad8452

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/rabbit_vhost.erl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@
2020

2121
%%----------------------------------------------------------------------------
2222

23-
-export([add/1, delete/1, exists/1, list/0, with/2, assert/1]).
23+
-export([add/1, delete/1, exists/1, list/0, with/2, with_user_and_vhost/3, assert/1]).
2424
-export([info/1, info/2, info_all/0, info_all/1, info_all/2, info_all/3]).
2525

2626
-spec add(rabbit_types:vhost()) -> 'ok'.
2727
-spec delete(rabbit_types:vhost()) -> 'ok'.
2828
-spec exists(rabbit_types:vhost()) -> boolean().
2929
-spec list() -> [rabbit_types:vhost()].
3030
-spec with(rabbit_types:vhost(), rabbit_misc:thunk(A)) -> A.
31+
-spec with_user_and_vhost
32+
(rabbit_types:username(), rabbit_types:vhost(), rabbit_misc:thunk(A)) -> A.
3133
-spec assert(rabbit_types:vhost()) -> 'ok'.
3234

3335
-spec info(rabbit_types:vhost()) -> rabbit_types:infos().
@@ -132,6 +134,9 @@ with(VHostPath, Thunk) ->
132134
end
133135
end.
134136

137+
with_user_and_vhost(Username, VHostPath, Thunk) ->
138+
rabbit_misc:with_user(Username, with(VHostPath, Thunk)).
139+
135140
%% Like with/2 but outside an Mnesia tx
136141
assert(VHostPath) -> case exists(VHostPath) of
137142
true -> ok;

0 commit comments

Comments
 (0)