]> granicus.if.org Git - ejabberd/commitdiff
PubSub: fix error type on item deletion with insufficient priviledge
authorChristophe Romain <christophe.romain@process-one.net>
Thu, 29 Sep 2016 09:20:56 +0000 (11:20 +0200)
committerEvgeniy Khramtsov <ekhramtsov@process-one.net>
Fri, 30 Sep 2016 04:51:17 +0000 (07:51 +0300)
src/node_flat.erl
src/node_flat_sql.erl

index e80aaad347ef35501def557a1e292f3bba510e16..e3170a2632bfb68c7b923e252dc309ba1c5135c3 100644 (file)
@@ -419,11 +419,11 @@ delete_item(Nidx, Publisher, PublishModel, ItemId) ->
     #pubsub_state{affiliation = Affiliation, items = Items} = GenState,
     Allowed = Affiliation == publisher orelse
        Affiliation == owner orelse
-       PublishModel == open orelse
-       case get_item(Nidx, ItemId) of
-       {result, #pubsub_item{creation = {_, GenKey}}} -> true;
-       _ -> false
-    end,
+       (PublishModel == open andalso
+         case get_item(Nidx, ItemId) of
+           {result, #pubsub_item{creation = {_, GenKey}}} -> true;
+           _ -> false
+          end),
     if not Allowed ->
            {error, xmpp:err_forbidden()};
        true ->
index 025f6caa8578c2697156bd8dd21cd6a43c2ceb42..ac590a1dc7b5d09aca93960823057cb1e1011c9f 100644 (file)
@@ -276,11 +276,11 @@ delete_item(Nidx, Publisher, PublishModel, ItemId) ->
     {result, Affiliation} = get_affiliation(Nidx, GenKey),
     Allowed = Affiliation == publisher orelse
        Affiliation == owner orelse
-       PublishModel == open orelse
-       case get_item(Nidx, ItemId) of
-       {result, #pubsub_item{creation = {_, GenKey}}} -> true;
-       _ -> false
-    end,
+       (PublishModel == open andalso
+         case get_item(Nidx, ItemId) of
+           {result, #pubsub_item{creation = {_, GenKey}}} -> true;
+           _ -> false
+          end),
     if not Allowed ->
            {error, xmpp:err_forbidden()};
        true ->