diff options
| -rw-r--r-- | src/rabbit_vhost.erl | 7 |
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; |
