25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-28 16:34:13 +01:00

Allow a subscribed owner/admin to change participant<->visitor

This commit is contained in:
Badlop 2018-09-20 11:14:11 +02:00
parent c3f62c037d
commit 9bac2fa185

View File

@ -2862,8 +2862,13 @@ find_changed_items(UJID, UAffiliation, URole,
TAffiliation = get_affiliation(JID, StateData), TAffiliation = get_affiliation(JID, StateData),
TRole = get_role(JID, StateData), TRole = get_role(JID, StateData),
ServiceAf = get_service_affiliation(JID, StateData), ServiceAf = get_service_affiliation(JID, StateData),
UIsSubscriber = is_subscriber(UJID, StateData),
URole1 = case {URole, UIsSubscriber} of
{none, true} -> subscriber;
{UR, _} -> UR
end,
CanChangeRA = case can_change_ra(UAffiliation, CanChangeRA = case can_change_ra(UAffiliation,
URole, URole1,
TAffiliation, TAffiliation,
TRole, RoleOrAff, RoleOrAffValue, TRole, RoleOrAff, RoleOrAffValue,
ServiceAf) of ServiceAf) of
@ -2986,6 +2991,11 @@ can_change_ra(_FAffiliation, moderator, _TAffiliation,
can_change_ra(_FAffiliation, moderator, _TAffiliation, can_change_ra(_FAffiliation, moderator, _TAffiliation,
visitor, role, participant, _ServiceAf) -> visitor, role, participant, _ServiceAf) ->
true; true;
can_change_ra(FAffiliation, subscriber, _TAffiliation,
visitor, role, participant, _ServiceAf)
when (FAffiliation == owner) or
(FAffiliation == admin) ->
true;
can_change_ra(FAffiliation, _FRole, _TAffiliation, can_change_ra(FAffiliation, _FRole, _TAffiliation,
visitor, role, moderator, _ServiceAf) visitor, role, moderator, _ServiceAf)
when (FAffiliation == owner) or when (FAffiliation == owner) or
@ -2997,6 +3007,11 @@ can_change_ra(_FAffiliation, moderator, _TAffiliation,
can_change_ra(_FAffiliation, moderator, _TAffiliation, can_change_ra(_FAffiliation, moderator, _TAffiliation,
participant, role, visitor, _ServiceAf) -> participant, role, visitor, _ServiceAf) ->
true; true;
can_change_ra(FAffiliation, subscriber, _TAffiliation,
participant, role, visitor, _ServiceAf)
when (FAffiliation == owner) or
(FAffiliation == admin) ->
true;
can_change_ra(FAffiliation, _FRole, _TAffiliation, can_change_ra(FAffiliation, _FRole, _TAffiliation,
participant, role, moderator, _ServiceAf) participant, role, moderator, _ServiceAf)
when (FAffiliation == owner) or when (FAffiliation == owner) or