]> 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)
committerChristophe Romain <christophe.romain@process-one.net>
Thu, 29 Sep 2016 09:20:56 +0000 (11:20 +0200)
src/node_flat.erl
src/node_flat_sql.erl

index 2fb24ee69059ab360fb2acb6dfcf80ed43f5f4f1..7ead1d351c93f9a7da55438494801d7caf6f8815 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, ?ERR_FORBIDDEN};
        true ->
index 86375eaec0a8c31cec78341a357dd87f8f9102b2..e7e5fb417ec314ec810380df96c25391b7db5dd6 100644 (file)
@@ -271,11 +271,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, ?ERR_FORBIDDEN};
        true ->