25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-22 17:28:25 +01:00

Allow pubsub node owner to overwrite items published by other persons

Owner is already permitted to delete those items, so it could do that by
deleting old item, and publishing it again, so i don't see reason to not
allow that overwrite.
This commit is contained in:
Paweł Chmielowski 2023-10-12 13:16:13 +02:00
parent 12d47455ba
commit f75909db4c
2 changed files with 14 additions and 0 deletions

View File

@ -385,6 +385,13 @@ publish_item(Nidx, Publisher, PublishModel, MaxItems, ItemId, Payload,
modification = {Now, SubKey},
payload = Payload}),
{result, {default, broadcast, []}};
% Allow node owner to modify any item, he can also delete it and recreate
{result, #pubsub_item{creation = {CreationTime, _}} = OldItem} when Affiliation == owner->
set_item(OldItem#pubsub_item{
creation = {CreationTime, GenKey},
modification = {Now, SubKey},
payload = Payload}),
{result, {default, broadcast, []}};
{result, _} ->
{error, xmpp:err_forbidden()};
_ ->

View File

@ -257,6 +257,13 @@ publish_item(Nidx, Publisher, PublishModel, MaxItems, ItemId, Payload,
modification = {Now, SubKey},
payload = Payload}),
{result, {default, broadcast, []}};
% Allow node owner to modify any item, he can also delete it and recreate
{result, #pubsub_item{creation = {CreationTime, _}} = OldItem} when Affiliation == owner->
set_item(OldItem#pubsub_item{
creation = {CreationTime, GenKey},
modification = {Now, SubKey},
payload = Payload}),
{result, {default, broadcast, []}};
{result, _} ->
{error, xmpp:err_forbidden()};
_ ->