summaryrefslogtreecommitdiff
path: root/src/rabbit_auth_backend_internal.erl
diff options
context:
space:
mode:
authorAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-06 13:24:17 +0100
committerAlexandru Scvortov <alexandru@rabbitmq.com>2011-09-06 13:24:17 +0100
commit22a76ec9ed8f8f4b17f9c83ffe9b58bde260ae4b (patch)
tree3586f4cba734eebe4bfc4b421bbd98d76b0db8da /src/rabbit_auth_backend_internal.erl
parent5e6b11369cd3a4c35f1681cdf3bda33c521cb5d0 (diff)
downloadrabbitmq-server-22a76ec9ed8f8f4b17f9c83ffe9b58bde260ae4b.tar.gz
log various ctl actions
Diffstat (limited to 'src/rabbit_auth_backend_internal.erl')
-rw-r--r--src/rabbit_auth_backend_internal.erl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/rabbit_auth_backend_internal.erl b/src/rabbit_auth_backend_internal.erl
index 6a018bd1..f8a8e587 100644
--- a/src/rabbit_auth_backend_internal.erl
+++ b/src/rabbit_auth_backend_internal.erl
@@ -150,6 +150,7 @@ permission_index(read) -> #permission.read.
%% Manipulation of the user database
add_user(Username, Password) ->
+ rabbit_log:info("Creating user '~s'~n", [Username]),
R = rabbit_misc:execute_mnesia_transaction(
fun () ->
case mnesia:wread({rabbit_user, Username}) of
@@ -165,10 +166,10 @@ add_user(Username, Password) ->
mnesia:abort({user_already_exists, Username})
end
end),
- rabbit_log:info("Created user ~p~n", [Username]),
R.
delete_user(Username) ->
+ rabbit_log:info("Deleting user '~s'~n", [Username]),
R = rabbit_misc:execute_mnesia_transaction(
rabbit_misc:with_user(
Username,
@@ -185,13 +186,14 @@ delete_user(Username) ->
write)],
ok
end)),
- rabbit_log:info("Deleted user ~p~n", [Username]),
R.
change_password(Username, Password) ->
+ rabbit_log:info("Changing password for '~s'~n", [Username]),
change_password_hash(Username, hash_password(Password)).
clear_password(Username) ->
+ rabbit_log:info("Clearing password for '~s'~n", [Username]),
change_password_hash(Username, <<"">>).
change_password_hash(Username, PasswordHash) ->
@@ -199,7 +201,6 @@ change_password_hash(Username, PasswordHash) ->
User#internal_user{
password_hash = PasswordHash }
end),
- rabbit_log:info("Changed password for user ~p~n", [Username]),
R.
hash_password(Cleartext) ->
@@ -221,11 +222,10 @@ salted_md5(Salt, Cleartext) ->
erlang:md5(Salted).
set_tags(Username, Tags) ->
+ rabbit_log:info("Setting user tags for user '~s' to ~p~n", [Username, Tags]),
R = update_user(Username, fun(User) ->
User#internal_user{tags = Tags}
end),
- rabbit_log:info("Set user tags for user ~p to ~p~n",
- [Username, Tags]),
R.
update_user(Username, Fun) ->
@@ -255,6 +255,8 @@ validate_regexp(RegexpBin) ->
end.
set_permissions(Username, VHostPath, ConfigurePerm, WritePerm, ReadPerm) ->
+ rabbit_log:info("Setting permissions for '~s' in '~s' to '~s', '~s', '~s'~n",
+ [Username, VHostPath, ConfigurePerm, WritePerm, ReadPerm]),
lists:map(fun validate_regexp/1, [ConfigurePerm, WritePerm, ReadPerm]),
rabbit_misc:execute_mnesia_transaction(
rabbit_misc:with_user_and_vhost(