diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2017-06-02 16:39:04 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2017-06-26 13:30:46 +0200 |
| commit | 3ad84520cb23e4bf05662e43384870de529d21a6 (patch) | |
| tree | 34932d75410c3fb1ab4b94b291ba4a52640a5d29 /src | |
| parent | ef5fc31c6eb8033895a7f4b29ab715f4ce313651 (diff) | |
| download | rabbitmq-server-git-3ad84520cb23e4bf05662e43384870de529d21a6.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]
Diffstat (limited to 'src')
| -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 eece5fefac..b557bb289d 100644 --- a/src/rabbit_vhost.erl +++ b/src/rabbit_vhost.erl @@ -20,7 +20,7 @@ %%---------------------------------------------------------------------------- --export([add/1, delete/1, exists/1, list/0, with/2, assert/1]). +-export([add/1, delete/1, exists/1, list/0, with/2, with_user_and_vhost/3, assert/1]). -export([info/1, info/2, info_all/0, info_all/1, info_all/2, info_all/3]). -spec add(rabbit_types:vhost()) -> 'ok'. @@ -28,6 +28,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(). @@ -132,6 +134,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; |
