]> granicus.if.org Git - ejabberd/commitdiff
Allow non-moderator subscribers to get list of room subscribers
authorPaweł Chmielowski <pchmielowski@process-one.net>
Thu, 25 Apr 2019 12:52:29 +0000 (14:52 +0200)
committerPaweł Chmielowski <pchmielowski@process-one.net>
Thu, 25 Apr 2019 12:52:47 +0000 (14:52 +0200)
rebar.config
src/mod_muc_room.erl

index ffb2a94bdb229cf1431c91f3b36b5c309c5e2f3d..583ca0b9b341d802028fe74fc5ec874e014abb3c 100644 (file)
@@ -24,7 +24,7 @@
         {fast_tls, ".*", {git, "https://github.com/processone/fast_tls", {tag, "1.1.0"}}},
         {stringprep, ".*", {git, "https://github.com/processone/stringprep", {tag, "1.0.15"}}},
         {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"}}},
         {jiffy, ".*", {git, "https://github.com/davisp/jiffy", {tag, "0.14.8"}}},
         {p1_oauth2, ".*", {git, "https://github.com/processone/p1_oauth2", {tag, "0.6.4"}}},
index f016f696a7e1cbe7e5ccc434fc3b6acee30b00d2..5778569df767c1dbfe5f5728b611f4712ede67d7 100644 (file)
@@ -4089,13 +4089,23 @@ process_iq_mucsub(From, #iq{type = get, lang = Lang,
                  StateData) ->
     FAffiliation = get_affiliation(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(
-                    fun(_, #subscriber{jid = J, nodes = Nodes}, Acc) ->
-                            [#muc_subscription{jid = J, events = Nodes}|Acc]
+                    fun(_, #subscriber{jid = J, nick = N, nodes = 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),
            {result, #muc_subscriptions{list = Subs}, StateData};
-       true ->
+       _ ->
            Txt = <<"Moderator privileges required">>,
            {error, xmpp:err_forbidden(Txt, Lang)}
     end;