mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-28 16:34:13 +01:00
Use new access_rules_validator in couple places
This commit is contained in:
parent
804190e4a8
commit
52d45604ba
@ -761,7 +761,7 @@ is_admin(Name, Auth, Extra) ->
|
|||||||
end,
|
end,
|
||||||
AdminAccess = ejabberd_config:get_option(
|
AdminAccess = ejabberd_config:get_option(
|
||||||
commands_admin_access,
|
commands_admin_access,
|
||||||
fun(A) when is_atom(A) -> A end,
|
fun(V) -> V end,
|
||||||
none),
|
none),
|
||||||
case acl:access_matches(AdminAccess, ACLInfo, Server) of
|
case acl:access_matches(AdminAccess, ACLInfo, Server) of
|
||||||
allow ->
|
allow ->
|
||||||
@ -773,8 +773,7 @@ is_admin(Name, Auth, Extra) ->
|
|||||||
deny -> false
|
deny -> false
|
||||||
end.
|
end.
|
||||||
|
|
||||||
opt_type(commands_admin_access) ->
|
opt_type(commands_admin_access) -> fun acl:access_rules_validator/1;
|
||||||
fun(A) when is_atom(A) -> A end;
|
|
||||||
opt_type(commands) ->
|
opt_type(commands) ->
|
||||||
fun(V) when is_list(V) -> V end;
|
fun(V) when is_list(V) -> V end;
|
||||||
opt_type(_) -> [commands, commands_admin_access].
|
opt_type(_) -> [commands, commands_admin_access].
|
||||||
|
@ -173,7 +173,7 @@ check_permissions2(_Request, Call, open) ->
|
|||||||
{allowed, Call, noauth};
|
{allowed, Call, noauth};
|
||||||
check_permissions2(#request{ip={IP, _Port}}, Call, _Policy) ->
|
check_permissions2(#request{ip={IP, _Port}}, Call, _Policy) ->
|
||||||
Access = gen_mod:get_module_opt(global, ?MODULE, admin_ip_access,
|
Access = gen_mod:get_module_opt(global, ?MODULE, admin_ip_access,
|
||||||
mod_opt_type(admin_ip_access),
|
fun(V) -> V end,
|
||||||
none),
|
none),
|
||||||
Res = acl:match_rule(global, Access, IP),
|
Res = acl:match_rule(global, Access, IP),
|
||||||
case Res of
|
case Res of
|
||||||
@ -502,6 +502,5 @@ log(Call, Args, {Addr, Port}) ->
|
|||||||
log(Call, Args, IP) ->
|
log(Call, Args, IP) ->
|
||||||
?INFO_MSG("API call ~s ~p (~p)", [Call, Args, IP]).
|
?INFO_MSG("API call ~s ~p (~p)", [Call, Args, IP]).
|
||||||
|
|
||||||
mod_opt_type(admin_ip_access) ->
|
mod_opt_type(admin_ip_access) -> fun acl:access_rules_validator/1;
|
||||||
fun(Access) when is_atom(Access) -> Access end;
|
|
||||||
mod_opt_type(_) -> [admin_ip_access].
|
mod_opt_type(_) -> [admin_ip_access].
|
||||||
|
Loading…
Reference in New Issue
Block a user