diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2016-09-29 11:20:56 +0200 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2016-09-29 11:20:56 +0200 |
commit | a42bf67957c18d66c05fac3f651ab198b59bef06 (patch) | |
tree | 5b08fb3ed3aa882efb2877f0b226370b923a645a /src | |
parent | Fix 404 response formatting (thanks to Kaggggggga)(#1306) (diff) |
PubSub: fix error type on item deletion with insufficient priviledge
Diffstat (limited to 'src')
-rw-r--r-- | src/node_flat.erl | 10 | ||||
-rw-r--r-- | src/node_flat_sql.erl | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/node_flat.erl b/src/node_flat.erl index 2fb24ee69..7ead1d351 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, ?ERR_FORBIDDEN}; true -> diff --git a/src/node_flat_sql.erl b/src/node_flat_sql.erl index 86375eaec..e7e5fb417 100644 --- a/src/node_flat_sql.erl +++ b/src/node_flat_sql.erl @@ -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 -> |