diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2010-11-22 16:04:47 +0000 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2010-11-22 16:04:47 +0000 |
commit | 51163cd8e2d931d22eb1ff69983ad6e520d8122e (patch) | |
tree | 197c26630d0135a2ba1706e632724c22e6875683 /src/rabbit_access_control.erl | |
parent | fb056d19c4c79a0cb36eeafb561a20846a16126b (diff) | |
download | rabbitmq-server-51163cd8e2d931d22eb1ff69983ad6e520d8122e.tar.gz |
Let an auth plugin specify which vhosts a user can see.
Diffstat (limited to 'src/rabbit_access_control.erl')
-rw-r--r-- | src/rabbit_access_control.erl | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rabbit_access_control.erl b/src/rabbit_access_control.erl index 0c399cd0..40e3cb7e 100644 --- a/src/rabbit_access_control.erl +++ b/src/rabbit_access_control.erl @@ -35,7 +35,7 @@ -export([user_pass_login/2, check_user_pass_login/2, check_user_login/2, make_salt/0, check_password/2, check_vhost_access/2, - check_resource_access/3]). + check_resource_access/3, list_vhosts/1]). -export([add_user/2, delete_user/1, change_password/2, set_admin/1, clear_admin/1, list_users/0, lookup_user/1]). -export([change_password_hash/2]). @@ -131,7 +131,7 @@ check_user_login(Username, AuthProps) -> check_vhost_access(User = #user{ username = Username, auth_backend = Module }, VHostPath) -> ?LOGDEBUG("Checking VHost access for ~p to ~p~n", [Username, VHostPath]), - case Module:check_vhost_access(User, VHostPath) of + case Module:check_vhost_access(User, VHostPath, write) of true -> ok; false -> @@ -153,6 +153,11 @@ check_resource_access(User = #user{username = Username, auth_backend = Module}, [rabbit_misc:rs(Resource), Username]) end. +list_vhosts(User = #user{auth_backend = Module}) -> + lists:filter(fun(VHost) -> + Module:check_vhost_access(User, VHost, read) + end, list_vhosts()). + %%---------------------------------------------------------------------------- add_user(Username, Password) -> |