25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Require that both tag and module matched in from of api_permission

This commit is contained in:
Paweł Chmielowski 2019-01-30 13:09:06 +01:00
parent 62ad1e5e4f
commit 096b4a50e5

View File

@ -265,7 +265,9 @@ get_definitions(#state{definitions = none, fragments_generators = Gens} = State)
matches_definition({_Name, {From, Who, What}}, Cmd, Module, Tag, Host, CallerInfo) -> matches_definition({_Name, {From, Who, What}}, Cmd, Module, Tag, Host, CallerInfo) ->
case What == all orelse lists:member(Cmd, What) of case What == all orelse lists:member(Cmd, What) of
true -> true ->
case From == [] orelse lists:member(Module, From) orelse lists:member({tag, Tag}, From) of {Tags, Modules} = lists:partition(fun({tag, _}) -> true; (_) -> false end, From),
case (Modules == [] orelse lists:member(Module, Modules)) andalso
(Tags == [] orelse lists:member({tag, Tag}, Tags)) of
true -> true ->
Scope = maps:get(oauth_scope, CallerInfo, none), Scope = maps:get(oauth_scope, CallerInfo, none),
lists:any( lists:any(