24
1
mirror of https://github.com/processone/ejabberd.git synced 2024-09-27 14:30:55 +02:00

Fix affiliation managment

Node owner can add/remove affiliations

SVN Revision: 2535
This commit is contained in:
Pablo Polvorin 2009-08-25 17:42:25 +00:00
parent b4f0bb65c6
commit fcf66c2e75
2 changed files with 4 additions and 4 deletions

View File

@ -2395,7 +2395,7 @@ set_affiliations(Host, Node, From, EntitiesEls) ->
#xmlel{name = 'affiliation', attrs = Attrs} -> #xmlel{name = 'affiliation', attrs = Attrs} ->
JID = try JID = try
exmpp_jid:parse( exmpp_jid:parse(
exmpp_xml:get_attribute_from_list_as_list(Attrs, 'jid', "")) exmpp_xml:get_attribute_from_list(Attrs, 'jid', ""))
catch catch
_:_ -> error _:_ -> error
end, end,
@ -2406,7 +2406,7 @@ set_affiliations(Host, Node, From, EntitiesEls) ->
(Affiliation == false) -> (Affiliation == false) ->
error; error;
true -> true ->
[{jlib:short_prepd_jid(JID), Affiliation} | Acc] [{JID, Affiliation} | Acc]
end end
end end
end end
@ -2420,7 +2420,7 @@ set_affiliations(Host, Node, From, EntitiesEls) ->
true -> true ->
lists:foreach( lists:foreach(
fun({JID, Affiliation}) -> fun({JID, Affiliation}) ->
node_call(Type, set_affiliation, [NodeId, JID, Affiliation]), {result, _} = node_call(Type, set_affiliation, [NodeId, JID, Affiliation]),
case Affiliation of case Affiliation of
owner -> owner ->
NewOwner = jlib:short_prepd_bare_jid(JID), NewOwner = jlib:short_prepd_bare_jid(JID),

View File

@ -619,7 +619,7 @@ get_affiliation(NodeId, Owner) ->
GenState = get_state(NodeId, GenKey), GenState = get_state(NodeId, GenKey),
{result, GenState#pubsub_state.affiliation}. {result, GenState#pubsub_state.affiliation}.
set_affiliation(NodeId, Owner, Affiliation) -> set_affiliation(NodeId, Owner, Affiliation) when ?IS_JID(Owner)->
GenKey = jlib:short_prepd_bare_jid(Owner), GenKey = jlib:short_prepd_bare_jid(Owner),
GenState = get_state(NodeId, GenKey), GenState = get_state(NodeId, GenKey),
case {Affiliation, GenState#pubsub_state.subscriptions} of case {Affiliation, GenState#pubsub_state.subscriptions} of