mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
XEP-0248 bugfix (EJAB-963) (Thanks to Brian Cully)
SVN Revision: 2353
This commit is contained in:
parent
67052929d5
commit
fc55db403e
@ -166,12 +166,13 @@ get_subnodes(Host, NodeID) ->
|
|||||||
qlc:e(Q)
|
qlc:e(Q)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_subnodes_tree(Host, NodeID, _From) ->
|
get_subnodes_tree(Host, NodeID, From) ->
|
||||||
Pred = fun (NID, #pubsub_node{parents = Parents}) ->
|
Pred = fun (NID, #pubsub_node{parents = Parents}) ->
|
||||||
lists:member(NID, Parents)
|
lists:member(NID, Parents)
|
||||||
end,
|
end,
|
||||||
Tr = fun (#pubsub_node{nodeid = {_, N}}) -> N end,
|
Tr = fun (#pubsub_node{nodeid = {_, N}}) -> [N] end,
|
||||||
traversal_helper(Pred, Tr, Host, [NodeID]).
|
traversal_helper(Pred, Tr, 1, Host, [NodeID],
|
||||||
|
[{0, [get_node(Host, NodeID, From)]}]).
|
||||||
|
|
||||||
%%====================================================================
|
%%====================================================================
|
||||||
%% Internal functions
|
%% Internal functions
|
||||||
@ -232,8 +233,9 @@ validate_parentage(Key, Owners, [ParentID | T]) ->
|
|||||||
MutualOwners = [O || O <- Owners, PO <- POwners,
|
MutualOwners = [O || O <- Owners, PO <- POwners,
|
||||||
O == PO],
|
O == PO],
|
||||||
case {MutualOwners, NodeType} of
|
case {MutualOwners, NodeType} of
|
||||||
{[], _} -> {error, ?ERR_NOT_ALLOWED};
|
{[], _} -> {error, ?ERR_FORBIDDEN};
|
||||||
{_, collection} -> validate_parentage(Key, Owners, T)
|
{_, collection} -> validate_parentage(Key, Owners, T);
|
||||||
|
{_, _} -> {error, ?ERR_NOT_ALLOWED}
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user