From: Christophe Romain Date: Thu, 29 Sep 2016 09:20:56 +0000 (+0200) Subject: PubSub: fix error type on item deletion with insufficient priviledge X-Git-Tag: 16.12-beta1~73 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7566e267a757146e0b333429010aed922ad57766;p=ejabberd PubSub: fix error type on item deletion with insufficient priviledge --- diff --git a/src/node_flat.erl b/src/node_flat.erl index e80aaad34..e3170a263 100644 --- a/src/node_flat.erl +++ b/src/node_flat.erl @@ -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 -> diff --git a/src/node_flat_sql.erl b/src/node_flat_sql.erl index 025f6caa8..ac590a1dc 100644 --- a/src/node_flat_sql.erl +++ b/src/node_flat_sql.erl @@ -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 ->