folded default user into default host

This commit is contained in:
Ben Hood 2008-08-06 15:47:45 +01:00
parent 2bf27f8cf7
commit d32428bf51
3 changed files with 5 additions and 13 deletions

View File

@ -213,12 +213,8 @@ insert_default_data() ->
{ok, DefaultPass} = application:get_env(default_pass),
{ok, DefaultVHost} = application:get_env(default_vhost),
ok = rabbit_access_control:add_vhost(DefaultVHost),
ok = insert_default_user(DefaultUser, DefaultPass, DefaultVHost),
ok.
insert_default_user(Username, Password, VHostPath) ->
ok = rabbit_access_control:add_user(Username, Password),
ok = rabbit_access_control:map_user_vhost(Username, VHostPath),
ok = rabbit_access_control:add_user(DefaultUser, DefaultPass),
ok = rabbit_access_control:map_user_vhost(DefaultUser, DefaultVHost),
ok.
start_builtin_amq_applications() ->

View File

@ -173,10 +173,8 @@ add_vhost(VHostPath) ->
case mnesia:read({vhost, VHostPath}) of
[] ->
ok = mnesia:write(#vhost{virtual_host = VHostPath}),
#exchange{} = rabbit_exchange:declare(rabbit_misc:r(VHostPath, exchange, <<"">>), direct, true, false, []),
#exchange{} = rabbit_exchange:declare(rabbit_misc:r(VHostPath, exchange, <<"amq.direct">>), direct, true, false, []),
#exchange{} = rabbit_exchange:declare(rabbit_misc:r(VHostPath, exchange, <<"amq.topic">>), topic, true, false, []),
#exchange{} = rabbit_exchange:declare(rabbit_misc:r(VHostPath, exchange, <<"amq.fanout">>), fanout, true, false, []),
[ rabbit_exchange:declare(rabbit_misc:r(VHostPath, exchange, Name), Type, true, false, []) || {Name,Type}
<- [{<<"">>, direct}, { <<"amq.direct">>, direct}, {<<"amq.topic">>, topic}, {<<"amq.fanout">>, fanout}]],
ok;
[_] ->
mnesia:abort({vhost_already_exists, VHostPath})

View File

@ -66,9 +66,7 @@
-spec(get_config/2 :: (atom(), A) -> A).
-spec(set_config/2 :: (atom(), any()) -> 'ok').
-spec(dirty_read/1 :: ({atom(), any()}) -> {'ok', any()} | not_found()).
-spec(r/3 :: (#resource{virtual_host :: vhost(),
kind :: K,
name :: '_' | vhost(), K, name()) ->
-spec(r/3 :: (#resource{virtual_host :: vhost()} | vhost(), K, name()) ->
r(K) when is_subtype(K, atom())).
-spec(r/2 :: (vhost(), K) -> #resource{virtual_host :: vhost(),
kind :: K,