summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2017-06-02 16:39:04 +0200
committerJean-Sébastien Pédron <jean-sebastien@rabbitmq.com>2017-06-26 14:53:52 +0200
commitdf5f0607d37fbff29157db647f3b5dde8d3ebd15 (patch)
tree649099c696bced9ec2aefa3772605d0c4fb1602b /src
parent0994b6bad44a706dac0ac118ed4f47c7e9c9cb87 (diff)
downloadrabbitmq-server-git-df5f0607d37fbff29157db647f3b5dde8d3ebd15.tar.gz
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] (cherry picked from commit 3ad84520cb23e4bf05662e43384870de529d21a6)
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_vhost.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/rabbit_vhost.erl b/src/rabbit_vhost.erl
index 1d1ea16cca..55c79d4ead 100644
--- a/src/rabbit_vhost.erl
+++ b/src/rabbit_vhost.erl
@@ -21,7 +21,7 @@
%%----------------------------------------------------------------------------
-export([recover/0, recover/1]).
--export([add/2, delete/2, exists/1, list/0, with/2, assert/1, update/2,
+-export([add/2, delete/2, exists/1, list/0, with/2, with_user_and_vhost/3, assert/1, update/2,
set_limits/2, limits_of/1]).
-export([info/1, info/2, info_all/0, info_all/1, info_all/2, info_all/3]).
-export([dir/1, msg_store_dir_path/1, msg_store_dir_wildcard/0]).
@@ -33,6 +33,8 @@
-spec exists(rabbit_types:vhost()) -> boolean().
-spec list() -> [rabbit_types:vhost()].
-spec with(rabbit_types:vhost(), rabbit_misc:thunk(A)) -> A.
+-spec with_user_and_vhost
+ (rabbit_types:username(), rabbit_types:vhost(), rabbit_misc:thunk(A)) -> A.
-spec assert(rabbit_types:vhost()) -> 'ok'.
-spec info(rabbit_types:vhost()) -> rabbit_types:infos().
@@ -179,6 +181,9 @@ with(VHostPath, Thunk) ->
end
end.
+with_user_and_vhost(Username, VHostPath, Thunk) ->
+ rabbit_misc:with_user(Username, with(VHostPath, Thunk)).
+
%% Like with/2 but outside an Mnesia tx
assert(VHostPath) -> case exists(VHostPath) of
true -> ok;