mirror of
https://github.com/processone/ejabberd.git
synced 2025-01-01 17:53:00 +01:00
Improve handling on acl rules in api_permissions
This commit is contained in:
parent
fdf69dcd0d
commit
a50247c20d
@ -266,7 +266,7 @@ matches_definition({_Name, {From, Who, What}}, Cmd, Module, Host, CallerInfo) ->
|
|||||||
lists:any(
|
lists:any(
|
||||||
fun({access, Access}) when Scope == none ->
|
fun({access, Access}) when Scope == none ->
|
||||||
acl:access_matches(Access, CallerInfo, Host) == allow;
|
acl:access_matches(Access, CallerInfo, Host) == allow;
|
||||||
({acl, _} = Acl) when Scope == none ->
|
({acl, Acl}) when Scope == none ->
|
||||||
acl:acl_rule_matches(Acl, CallerInfo, Host);
|
acl:acl_rule_matches(Acl, CallerInfo, Host);
|
||||||
({oauth, Scopes, List}) when Scope /= none ->
|
({oauth, Scopes, List}) when Scope /= none ->
|
||||||
case ejabberd_oauth:scope_in_scope_list(Scope, Scopes) of
|
case ejabberd_oauth:scope_in_scope_list(Scope, Scopes) of
|
||||||
@ -274,7 +274,7 @@ matches_definition({_Name, {From, Who, What}}, Cmd, Module, Host, CallerInfo) ->
|
|||||||
lists:any(
|
lists:any(
|
||||||
fun({access, Access}) ->
|
fun({access, Access}) ->
|
||||||
acl:access_matches(Access, CallerInfo, Host) == allow;
|
acl:access_matches(Access, CallerInfo, Host) == allow;
|
||||||
({acl, _} = Acl) ->
|
({acl, Acl} = Acl) ->
|
||||||
acl:acl_rule_matches(Acl, CallerInfo, Host)
|
acl:acl_rule_matches(Acl, CallerInfo, Host)
|
||||||
end, List);
|
end, List);
|
||||||
_ ->
|
_ ->
|
||||||
@ -407,7 +407,7 @@ parse_who(Name, Defs, ParseOauth) when is_list(Defs) ->
|
|||||||
{scope, ScopeList2}
|
{scope, ScopeList2}
|
||||||
end;
|
end;
|
||||||
(Atom) when is_atom(Atom) ->
|
(Atom) when is_atom(Atom) ->
|
||||||
{acl, Atom};
|
{acl, {acl, Atom}};
|
||||||
([Other]) ->
|
([Other]) ->
|
||||||
try acl:normalize_spec(Other) of
|
try acl:normalize_spec(Other) of
|
||||||
Rule2 ->
|
Rule2 ->
|
||||||
|
Loading…
Reference in New Issue
Block a user