diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2022-02-02 22:35:28 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2022-02-02 22:35:28 +0100 |
commit | 67b5de05c73924f393d663991df2b03bf7e24d8f (patch) | |
tree | 946c00eb9615afff9a7c683bae78259d4912f1bc | |
parent | Make dialyzer happy (diff) |
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.
-rw-r--r-- | src/mod_pubsub.erl | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index 58aad47cb..c86d5fdbf 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -2262,10 +2262,11 @@ get_affiliations(Host, Node, JID) -> set_affiliations(Host, Node, From, Affs) -> Owner = jid:tolower(jid:remove_resource(From)), 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), case lists:member(Owner, Owners) of true -> + AccessModel = get_option(Options, access_model), OwnerJID = jid:make(Owner), FilteredAffs = case Owners of @@ -2298,6 +2299,17 @@ set_affiliations(Host, Node, From, Affs) -> end; _ -> 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, FilteredAffs), {result, undefined}; |