|
20 | 20 |
|
21 | 21 | %%---------------------------------------------------------------------------- |
22 | 22 |
|
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]). |
24 | 24 | -export([info/1, info/2, info_all/0, info_all/1, info_all/2, info_all/3]). |
25 | 25 |
|
26 | 26 | -spec add(rabbit_types:vhost()) -> 'ok'. |
27 | 27 | -spec delete(rabbit_types:vhost()) -> 'ok'. |
28 | 28 | -spec exists(rabbit_types:vhost()) -> boolean(). |
29 | 29 | -spec list() -> [rabbit_types:vhost()]. |
30 | 30 | -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. |
31 | 33 | -spec assert(rabbit_types:vhost()) -> 'ok'. |
32 | 34 |
|
33 | 35 | -spec info(rabbit_types:vhost()) -> rabbit_types:infos(). |
@@ -132,6 +134,9 @@ with(VHostPath, Thunk) -> |
132 | 134 | end |
133 | 135 | end. |
134 | 136 |
|
| 137 | +with_user_and_vhost(Username, VHostPath, Thunk) -> |
| 138 | + rabbit_misc:with_user(Username, with(VHostPath, Thunk)). |
| 139 | + |
135 | 140 | %% Like with/2 but outside an Mnesia tx |
136 | 141 | assert(VHostPath) -> case exists(VHostPath) of |
137 | 142 | true -> ok; |
|
0 commit comments