diff options
author | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-04-30 19:01:47 +0300 |
---|---|---|
committer | Evgeniy Khramtsov <ekhramtsov@process-one.net> | 2017-04-30 19:01:47 +0300 |
commit | fddd6110e00df12c99a20a2cc9d074f5f4f1f965 (patch) | |
tree | 366575b855f1b2013db7eeb02ecb213f81c98c1f /src/ejabberd_commands.erl | |
parent | Merge branch 'new-option-validation' (diff) |
Don't validate an option in gen_mod:get*opt() functions
The changes are very similar to those from previous commit:
* Now there is no need to pass validating function in
gen_mod:get_opt() and gen_mod:get_module_opt() functions,
because the modules' configuration keeps already validated values.
* New functions gen_mod:get_opt/2 and gen_mod:get_module_opt/3 are
introduced.
* Functions gen_mod:get_opt/4 and get_module_opt/5 are deprecated.
If the functions are still called, the "function" argument is
simply ignored.
* Validating callback Mod:listen_opt_type/1 is introduced to validate
listening options at startup.
Diffstat (limited to 'src/ejabberd_commands.erl')
-rw-r--r-- | src/ejabberd_commands.erl | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ejabberd_commands.erl b/src/ejabberd_commands.erl index 3a6f6db1..c8822032 100644 --- a/src/ejabberd_commands.erl +++ b/src/ejabberd_commands.erl @@ -614,12 +614,12 @@ execute_check_access(undefined, _Command, _Arguments) -> execute_check_access(FromJID, #ejabberd_commands{access = AccessRefs} = Command, Arguments) -> %% TODO Review: Do we have smarter / better way to check rule on other Host than global ? Host = global, - Rules = lists:map(fun({Mod, AccessName, Default}) -> - gen_mod:get_module_opt(Host, Mod, - AccessName, fun(A) -> A end, Default); - (Default) -> - Default - end, AccessRefs), + Rules = lists:map( + fun({Mod, AccessName, Default}) -> + gen_mod:get_module_opt(Host, Mod, AccessName, Default); + (Default) -> + Default + end, AccessRefs), case acl:any_rules_allowed(Host, Rules, FromJID) of true -> do_execute_command(Command, Arguments); |