diff options
| author | Michael Klishin <mklishin@pivotal.io> | 2015-10-10 13:37:08 +0300 |
|---|---|---|
| committer | Michael Klishin <mklishin@pivotal.io> | 2015-10-10 13:37:08 +0300 |
| commit | c863a81e480fcfe08271588d9e630e3e782939f6 (patch) | |
| tree | 9a08114783c65f01ec2b300c0fad43afd77de596 /src | |
| parent | 215dac355a77c4e2f87a98aee998693c98d37349 (diff) | |
| parent | 1a7db7371fb0eb537c259f593b30ffb5ee9145f5 (diff) | |
| download | rabbitmq-server-git-c863a81e480fcfe08271588d9e630e3e782939f6.tar.gz | |
Merge branch 'master' into rabbitmq-server-336
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_access_control.erl | 13 | ||||
| -rw-r--r-- | src/rabbit_auth_backend_internal.erl | 4 | ||||
| -rw-r--r-- | src/rabbit_authz_backend.erl | 4 | ||||
| -rw-r--r-- | src/rabbit_error_logger_file_h.erl | 8 |
4 files changed, 16 insertions, 13 deletions
diff --git a/src/rabbit_access_control.erl b/src/rabbit_access_control.erl index 1f9f928538..3fe7212276 100644 --- a/src/rabbit_access_control.erl +++ b/src/rabbit_access_control.erl @@ -76,7 +76,7 @@ check_user_login(Username, AuthProps) -> %% it gives us case try_authenticate(Mod, Username, AuthProps) of {ok, ModNUser = #auth_user{impl = Impl}} -> - user(ModNUser, {ok, [{Mod, Impl}]}); + user(ModNUser, {ok, [{Mod, Impl}], []}); Else -> Else end; @@ -98,9 +98,10 @@ try_authenticate(Module, Username, AuthProps) -> try_authorize(Modules, Username) -> lists:foldr( - fun (Module, {ok, ModsImpls}) -> + fun (Module, {ok, ModsImpls, ModsTags}) -> case Module:user_login_authorization(Username) of - {ok, Impl} -> {ok, [{Module, Impl} | ModsImpls]}; + {ok, Impl, Tags}-> {ok, [{Module, Impl} | ModsImpls], ModsTags ++ Tags}; + {ok, Impl} -> {ok, [{Module, Impl} | ModsImpls], ModsTags}; {error, E} -> {refused, Username, "~s failed authorizing ~s: ~p~n", [Module, Username, E]}; @@ -108,11 +109,11 @@ try_authorize(Modules, Username) -> end; (_, {refused, F, A}) -> {refused, Username, F, A} - end, {ok, []}, Modules). + end, {ok, [], []}, Modules). -user(#auth_user{username = Username, tags = Tags}, {ok, ModZImpls}) -> +user(#auth_user{username = Username, tags = Tags}, {ok, ModZImpls, ModZTags}) -> {ok, #user{username = Username, - tags = Tags, + tags = Tags ++ ModZTags, authz_backends = ModZImpls}}; user(_AuthUser, Error) -> Error. diff --git a/src/rabbit_auth_backend_internal.erl b/src/rabbit_auth_backend_internal.erl index eaef7cfda5..6babe135fa 100644 --- a/src/rabbit_auth_backend_internal.erl +++ b/src/rabbit_auth_backend_internal.erl @@ -104,8 +104,8 @@ user_login_authentication(Username, AuthProps) -> user_login_authorization(Username) -> case user_login_authentication(Username, []) of - {ok, #auth_user{impl = Impl}} -> {ok, Impl}; - Else -> Else + {ok, #auth_user{impl = Impl, tags = Tags}} -> {ok, Impl, Tags}; + Else -> Else end. internal_check_user_login(Username, Fun) -> diff --git a/src/rabbit_authz_backend.erl b/src/rabbit_authz_backend.erl index 12364b654b..495a79695d 100644 --- a/src/rabbit_authz_backend.erl +++ b/src/rabbit_authz_backend.erl @@ -29,13 +29,15 @@ %% %% Possible responses: %% {ok, Impl} -%% User authorisation succeeded, and here's the impl field. +%% {ok, Impl, Tags} +%% User authorisation succeeded, and here's the impl and potential extra tags fields. %% {error, Error} %% Something went wrong. Log and die. %% {refused, Msg, Args} %% User authorisation failed. Log and die. -callback user_login_authorization(rabbit_types:username()) -> {'ok', any()} | + {'ok', any(), any()} | {'refused', string(), [any()]} | {'error', any()}. diff --git a/src/rabbit_error_logger_file_h.erl b/src/rabbit_error_logger_file_h.erl index 0758a98484..f8166bfcd1 100644 --- a/src/rabbit_error_logger_file_h.erl +++ b/src/rabbit_error_logger_file_h.erl @@ -37,10 +37,10 @@ %% extracted from error_logger_file_h. See comment above. get_depth() -> case application:get_env(kernel, error_logger_format_depth) of - {ok, Depth} when is_integer(Depth) -> - max(10, Depth); - undefined -> - unlimited + {ok, Depth} when is_integer(Depth) -> + erlang:max(10, Depth); + undefined -> + unlimited end. -define(ERTS_NEW_LOGGER_STATE, "7.1"). |
