mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Allow non-moderator subscribers to get list of room subscribers
This commit is contained in:
parent
a0c8c70c9c
commit
17444ba84e
@ -24,7 +24,7 @@
|
|||||||
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.1.0"}}},
|
{fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.1.0"}}},
|
||||||
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.15"}}},
|
{stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.15"}}},
|
||||||
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.35"}}},
|
{fast_xml, ".*", {git, "https://github.com/processone/fast_xml", {tag, "1.1.35"}}},
|
||||||
{xmpp, ".*", {git, "https://github.com/processone/xmpp", "f3e953e8"}},
|
{xmpp, ".*", {git, "https://github.com/processone/xmpp", "d8e770495a42c22cd23536c85af5b1fd92a2139a"}},
|
||||||
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.18"}}},
|
{fast_yaml, ".*", {git, "https://github.com/processone/fast_yaml", {tag, "1.0.18"}}},
|
||||||
{jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}},
|
{jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}},
|
||||||
{p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.4"}}},
|
{p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.4"}}},
|
||||||
|
@ -4089,13 +4089,23 @@ process_iq_mucsub(From, #iq{type = get, lang = Lang,
|
|||||||
StateData) ->
|
StateData) ->
|
||||||
FAffiliation = get_affiliation(From, StateData),
|
FAffiliation = get_affiliation(From, StateData),
|
||||||
FRole = get_role(From, StateData),
|
FRole = get_role(From, StateData),
|
||||||
if FRole == moderator; FAffiliation == owner; FAffiliation == admin ->
|
IsModerator = FRole == moderator orelse FAffiliation == owner orelse
|
||||||
|
FAffiliation == admin,
|
||||||
|
case IsModerator orelse is_subscriber(From, StateData) of
|
||||||
|
true ->
|
||||||
|
ShowJid = IsModerator orelse
|
||||||
|
(StateData#state.config)#config.anonymous == false,
|
||||||
Subs = maps:fold(
|
Subs = maps:fold(
|
||||||
fun(_, #subscriber{jid = J, nodes = Nodes}, Acc) ->
|
fun(_, #subscriber{jid = J, nick = N, nodes = Nodes}, Acc) ->
|
||||||
[#muc_subscription{jid = J, events = Nodes}|Acc]
|
case ShowJid of
|
||||||
|
true ->
|
||||||
|
[#muc_subscription{jid = J, events = Nodes}|Acc];
|
||||||
|
_ ->
|
||||||
|
[#muc_subscription{nick = N, events = Nodes}|Acc]
|
||||||
|
end
|
||||||
end, [], StateData#state.subscribers),
|
end, [], StateData#state.subscribers),
|
||||||
{result, #muc_subscriptions{list = Subs}, StateData};
|
{result, #muc_subscriptions{list = Subs}, StateData};
|
||||||
true ->
|
_ ->
|
||||||
Txt = <<"Moderator privileges required">>,
|
Txt = <<"Moderator privileges required">>,
|
||||||
{error, xmpp:err_forbidden(Txt, Lang)}
|
{error, xmpp:err_forbidden(Txt, Lang)}
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user