mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +01:00
PubSub: fix error type on item deletion with insufficient priviledge
This commit is contained in:
parent
d327119cf7
commit
7566e267a7
@ -419,11 +419,11 @@ delete_item(Nidx, Publisher, PublishModel, ItemId) ->
|
|||||||
#pubsub_state{affiliation = Affiliation, items = Items} = GenState,
|
#pubsub_state{affiliation = Affiliation, items = Items} = GenState,
|
||||||
Allowed = Affiliation == publisher orelse
|
Allowed = Affiliation == publisher orelse
|
||||||
Affiliation == owner orelse
|
Affiliation == owner orelse
|
||||||
PublishModel == open orelse
|
(PublishModel == open andalso
|
||||||
case get_item(Nidx, ItemId) of
|
case get_item(Nidx, ItemId) of
|
||||||
{result, #pubsub_item{creation = {_, GenKey}}} -> true;
|
{result, #pubsub_item{creation = {_, GenKey}}} -> true;
|
||||||
_ -> false
|
_ -> false
|
||||||
end,
|
end),
|
||||||
if not Allowed ->
|
if not Allowed ->
|
||||||
{error, xmpp:err_forbidden()};
|
{error, xmpp:err_forbidden()};
|
||||||
true ->
|
true ->
|
||||||
|
@ -276,11 +276,11 @@ delete_item(Nidx, Publisher, PublishModel, ItemId) ->
|
|||||||
{result, Affiliation} = get_affiliation(Nidx, GenKey),
|
{result, Affiliation} = get_affiliation(Nidx, GenKey),
|
||||||
Allowed = Affiliation == publisher orelse
|
Allowed = Affiliation == publisher orelse
|
||||||
Affiliation == owner orelse
|
Affiliation == owner orelse
|
||||||
PublishModel == open orelse
|
(PublishModel == open andalso
|
||||||
case get_item(Nidx, ItemId) of
|
case get_item(Nidx, ItemId) of
|
||||||
{result, #pubsub_item{creation = {_, GenKey}}} -> true;
|
{result, #pubsub_item{creation = {_, GenKey}}} -> true;
|
||||||
_ -> false
|
_ -> false
|
||||||
end,
|
end),
|
||||||
if not Allowed ->
|
if not Allowed ->
|
||||||
{error, xmpp:err_forbidden()};
|
{error, xmpp:err_forbidden()};
|
||||||
true ->
|
true ->
|
||||||
|
Loading…
Reference in New Issue
Block a user