mirror of
https://github.com/processone/ejabberd.git
synced 2024-06-20 22:22:09 +02:00
fix subscribers publish_model
SVN Revision: 2393
This commit is contained in:
parent
ff1f4f5a35
commit
9d9fca5e19
|
@ -467,13 +467,15 @@ publish_item(NodeId, Publisher, PublishModel, MaxItems, ItemId, Payload) ->
|
||||||
_ -> get_state(NodeId, SubKey)
|
_ -> get_state(NodeId, SubKey)
|
||||||
end,
|
end,
|
||||||
Affiliation = GenState#pubsub_state.affiliation,
|
Affiliation = GenState#pubsub_state.affiliation,
|
||||||
Subscription = SubState#pubsub_state.subscriptions,
|
Subscribed = case PublishModel of
|
||||||
|
subscribers -> is_subscribed(SubState#pubsub_state.subscriptions);
|
||||||
|
_ -> undefined
|
||||||
|
end,
|
||||||
if
|
if
|
||||||
not ((PublishModel == open)
|
not ((PublishModel == open)
|
||||||
or ((PublishModel == publishers)
|
or ((PublishModel == publishers)
|
||||||
and ((Affiliation == owner) or (Affiliation == publisher)))
|
and ((Affiliation == owner) or (Affiliation == publisher)))
|
||||||
or ((PublishModel == subscribers)
|
or (Subscribed == true)) ->
|
||||||
and (Subscription == subscribed))) ->
|
|
||||||
%% Entity does not have sufficient privileges to publish to node
|
%% Entity does not have sufficient privileges to publish to node
|
||||||
{error, ?ERR_FORBIDDEN};
|
{error, ?ERR_FORBIDDEN};
|
||||||
true ->
|
true ->
|
||||||
|
@ -906,8 +908,8 @@ get_item(NodeId, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, _S
|
||||||
GenKey = jlib:jid_remove_resource(SubKey),
|
GenKey = jlib:jid_remove_resource(SubKey),
|
||||||
GenState = get_state(NodeId, GenKey),
|
GenState = get_state(NodeId, GenKey),
|
||||||
Affiliation = GenState#pubsub_state.affiliation,
|
Affiliation = GenState#pubsub_state.affiliation,
|
||||||
Subscription = GenState#pubsub_state.subscriptions,
|
Subscriptions = GenState#pubsub_state.subscriptions,
|
||||||
Whitelisted = can_fetch_item(Affiliation, Subscription),
|
Whitelisted = can_fetch_item(Affiliation, Subscriptions),
|
||||||
if
|
if
|
||||||
%%SubID == "", ?? ->
|
%%SubID == "", ?? ->
|
||||||
%% Entity has multiple subscriptions to the node but does not specify a subscription ID
|
%% Entity has multiple subscriptions to the node but does not specify a subscription ID
|
||||||
|
@ -970,11 +972,13 @@ can_fetch_item(owner, _) -> true;
|
||||||
can_fetch_item(member, _) -> true;
|
can_fetch_item(member, _) -> true;
|
||||||
can_fetch_item(publisher, _) -> true;
|
can_fetch_item(publisher, _) -> true;
|
||||||
can_fetch_item(outcast, _) -> false;
|
can_fetch_item(outcast, _) -> false;
|
||||||
can_fetch_item(none, Subscriptions) ->
|
can_fetch_item(none, Subscriptions) -> is_subscribed(Subscriptions);
|
||||||
|
can_fetch_item(_Affiliation, _Subscription) -> false.
|
||||||
|
|
||||||
|
is_subscribed(Subscriptions) ->
|
||||||
lists:any(fun ({subscribed, _SubID}) -> true;
|
lists:any(fun ({subscribed, _SubID}) -> true;
|
||||||
(_) -> false
|
(_) -> false
|
||||||
end, Subscriptions);
|
end, Subscriptions).
|
||||||
can_fetch_item(_Affiliation, _Subscription) -> false.
|
|
||||||
|
|
||||||
%% Returns the first item where Pred() is true in List
|
%% Returns the first item where Pred() is true in List
|
||||||
first_in_list(_Pred, []) ->
|
first_in_list(_Pred, []) ->
|
||||||
|
|
Loading…
Reference in New Issue
Block a user