24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-06-14 22:00:16 +02:00

access_createnode acl also applies to auto created nodes

This commit is contained in:
Matthias Rieber 2012-10-18 19:46:28 +02:00
parent ec51ba7bc6
commit cdb2ebe4bd

View File

@ -1248,7 +1248,7 @@ iq_pubsub(Host, ServerHost, From, IQType, SubEl, Lang, Access, Plugins) ->
case xml:remove_cdata(Els) of case xml:remove_cdata(Els) of
[{xmlelement, "item", ItemAttrs, Payload}] -> [{xmlelement, "item", ItemAttrs, Payload}] ->
ItemId = xml:get_attr_s("id", ItemAttrs), ItemId = xml:get_attr_s("id", ItemAttrs),
publish_item(Host, ServerHost, Node, From, ItemId, Payload); publish_item(Host, ServerHost, Node, From, ItemId, Payload, Access);
[] -> [] ->
%% Publisher attempts to publish to persistent node with no item %% Publisher attempts to publish to persistent node with no item
{error, extended_error(?ERR_BAD_REQUEST, {error, extended_error(?ERR_BAD_REQUEST,
@ -2030,8 +2030,10 @@ unsubscribe_node(Host, Node, From, Subscriber, SubId) ->
%%</ul> %%</ul>
publish_item(Host, ServerHost, Node, Publisher, "", Payload) -> publish_item(Host, ServerHost, Node, Publisher, "", Payload) ->
%% if publisher does not specify an ItemId, the service MUST generate the ItemId %% if publisher does not specify an ItemId, the service MUST generate the ItemId
publish_item(Host, ServerHost, Node, Publisher, uniqid(), Payload); publish_item(Host, ServerHost, Node, Publisher, uniqid(), Payload, all);
publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) -> publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) ->
publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload, all).
publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload, Access) ->
Action = fun(#pubsub_node{options = Options, type = Type, id = NodeId}) -> Action = fun(#pubsub_node{options = Options, type = Type, id = NodeId}) ->
Features = features(Type), Features = features(Type),
PublishFeature = lists:member("publish", Features), PublishFeature = lists:member("publish", Features),
@ -2122,7 +2124,7 @@ publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) ->
Type = select_type(ServerHost, Host, Node), Type = select_type(ServerHost, Host, Node),
case lists:member("auto-create", features(Type)) of case lists:member("auto-create", features(Type)) of
true -> true ->
case create_node(Host, ServerHost, Node, Publisher, Type) of case create_node(Host, ServerHost, Node, Publisher, Type, Access, []) of
{result, [{xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}], {result, [{xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB}],
[{xmlelement, "create", [{"node", NewNode}], []}]}]} -> [{xmlelement, "create", [{"node", NewNode}], []}]}]} ->
publish_item(Host, ServerHost, list_to_binary(NewNode), publish_item(Host, ServerHost, list_to_binary(NewNode),