mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
mod_pubsub: Unsubscribe JID on whitelist removal
If a JID is removed from the affiliation lists of a node with access model 'whitelist', remove it from the list of subscribers as well.
This commit is contained in:
parent
11c725018b
commit
67b5de05c7
@ -2262,10 +2262,11 @@ get_affiliations(Host, Node, JID) ->
|
|||||||
set_affiliations(Host, Node, From, Affs) ->
|
set_affiliations(Host, Node, From, Affs) ->
|
||||||
Owner = jid:tolower(jid:remove_resource(From)),
|
Owner = jid:tolower(jid:remove_resource(From)),
|
||||||
Action =
|
Action =
|
||||||
fun(#pubsub_node{type = Type, id = Nidx, owners = O} = N) ->
|
fun(#pubsub_node{type = Type, id = Nidx, owners = O, options = Options} = N) ->
|
||||||
Owners = node_owners_call(Host, Type, Nidx, O),
|
Owners = node_owners_call(Host, Type, Nidx, O),
|
||||||
case lists:member(Owner, Owners) of
|
case lists:member(Owner, Owners) of
|
||||||
true ->
|
true ->
|
||||||
|
AccessModel = get_option(Options, access_model),
|
||||||
OwnerJID = jid:make(Owner),
|
OwnerJID = jid:make(Owner),
|
||||||
FilteredAffs =
|
FilteredAffs =
|
||||||
case Owners of
|
case Owners of
|
||||||
@ -2298,6 +2299,17 @@ set_affiliations(Host, Node, From, Affs) ->
|
|||||||
end;
|
end;
|
||||||
_ ->
|
_ ->
|
||||||
ok
|
ok
|
||||||
|
end,
|
||||||
|
case AccessModel of
|
||||||
|
whitelist when Affiliation /= owner,
|
||||||
|
Affiliation /= publisher,
|
||||||
|
Affiliation /= member ->
|
||||||
|
node_action(Host, Type,
|
||||||
|
unsubscribe_node,
|
||||||
|
[Nidx, OwnerJID, JID,
|
||||||
|
all]);
|
||||||
|
_ ->
|
||||||
|
ok
|
||||||
end
|
end
|
||||||
end, FilteredAffs),
|
end, FilteredAffs),
|
||||||
{result, undefined};
|
{result, undefined};
|
||||||
|
Loading…
Reference in New Issue
Block a user