mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-02 16:37:52 +01:00
* src/mod_muc/mod_muc_room.erl: Fix to allow a server admin to add
himself as owner of a room (EJAB-687) SVN Revision: 1460
This commit is contained in:
parent
82e8b16a39
commit
4ebaf3efa0
@ -1,5 +1,8 @@
|
|||||||
2008-07-17 Badlop <badlop@process-one.net>
|
2008-07-17 Badlop <badlop@process-one.net>
|
||||||
|
|
||||||
|
* src/mod_muc/mod_muc_room.erl: Fix to allow a server admin to add
|
||||||
|
himself as owner of a room (EJAB-687)
|
||||||
|
|
||||||
* src/Makefile.in: ejabberctl doesn't use the erl found by the
|
* src/Makefile.in: ejabberctl doesn't use the erl found by the
|
||||||
configure script (EJAB-676)
|
configure script (EJAB-676)
|
||||||
* src/ejabberdctl.template: Likewise
|
* src/ejabberdctl.template: Likewise
|
||||||
|
@ -2157,11 +2157,13 @@ find_changed_items(UJID, UAffiliation, URole,
|
|||||||
[StrAffiliation]),
|
[StrAffiliation]),
|
||||||
{error, ?ERRT_NOT_ACCEPTABLE(Lang, ErrText1)};
|
{error, ?ERRT_NOT_ACCEPTABLE(Lang, ErrText1)};
|
||||||
SAffiliation ->
|
SAffiliation ->
|
||||||
|
ServiceAf = get_service_affiliation(JID, StateData),
|
||||||
CanChangeRA =
|
CanChangeRA =
|
||||||
case can_change_ra(
|
case can_change_ra(
|
||||||
UAffiliation, URole,
|
UAffiliation, URole,
|
||||||
TAffiliation, TRole,
|
TAffiliation, TRole,
|
||||||
affiliation, SAffiliation) of
|
affiliation, SAffiliation,
|
||||||
|
ServiceAf) of
|
||||||
nothing ->
|
nothing ->
|
||||||
nothing;
|
nothing;
|
||||||
true ->
|
true ->
|
||||||
@ -2212,11 +2214,13 @@ find_changed_items(UJID, UAffiliation, URole,
|
|||||||
[StrRole]),
|
[StrRole]),
|
||||||
{error, ?ERRT_BAD_REQUEST(Lang, ErrText1)};
|
{error, ?ERRT_BAD_REQUEST(Lang, ErrText1)};
|
||||||
SRole ->
|
SRole ->
|
||||||
|
ServiceAf = get_service_affiliation(JID, StateData),
|
||||||
CanChangeRA =
|
CanChangeRA =
|
||||||
case can_change_ra(
|
case can_change_ra(
|
||||||
UAffiliation, URole,
|
UAffiliation, URole,
|
||||||
TAffiliation, TRole,
|
TAffiliation, TRole,
|
||||||
role, SRole) of
|
role, SRole,
|
||||||
|
ServiceAf) of
|
||||||
nothing ->
|
nothing ->
|
||||||
nothing;
|
nothing;
|
||||||
true ->
|
true ->
|
||||||
@ -2262,143 +2266,149 @@ find_changed_items(_UJID, _UAffiliation, _URole, _Items,
|
|||||||
{error, ?ERR_BAD_REQUEST}.
|
{error, ?ERR_BAD_REQUEST}.
|
||||||
|
|
||||||
|
|
||||||
|
can_change_ra(_FAffiliation, _FRole,
|
||||||
|
owner, _TRole,
|
||||||
|
affiliation, owner, owner) ->
|
||||||
|
%% A room owner tries to add as persistent owner a
|
||||||
|
%% participant that is already owner because he is MUC admin
|
||||||
|
true;
|
||||||
can_change_ra(_FAffiliation, _FRole,
|
can_change_ra(_FAffiliation, _FRole,
|
||||||
TAffiliation, _TRole,
|
TAffiliation, _TRole,
|
||||||
affiliation, Value)
|
affiliation, Value, _ServiceAf)
|
||||||
when (TAffiliation == Value) ->
|
when (TAffiliation == Value) ->
|
||||||
nothing;
|
nothing;
|
||||||
can_change_ra(_FAffiliation, _FRole,
|
can_change_ra(_FAffiliation, _FRole,
|
||||||
_TAffiliation, TRole,
|
_TAffiliation, TRole,
|
||||||
role, Value)
|
role, Value, _ServiceAf)
|
||||||
when (TRole == Value) ->
|
when (TRole == Value) ->
|
||||||
nothing;
|
nothing;
|
||||||
can_change_ra(FAffiliation, _FRole,
|
can_change_ra(FAffiliation, _FRole,
|
||||||
outcast, _TRole,
|
outcast, _TRole,
|
||||||
affiliation, none)
|
affiliation, none, _ServiceAf)
|
||||||
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(FAffiliation, _FRole,
|
can_change_ra(FAffiliation, _FRole,
|
||||||
outcast, _TRole,
|
outcast, _TRole,
|
||||||
affiliation, member)
|
affiliation, member, _ServiceAf)
|
||||||
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(owner, _FRole,
|
can_change_ra(owner, _FRole,
|
||||||
outcast, _TRole,
|
outcast, _TRole,
|
||||||
affiliation, admin) ->
|
affiliation, admin, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(owner, _FRole,
|
can_change_ra(owner, _FRole,
|
||||||
outcast, _TRole,
|
outcast, _TRole,
|
||||||
affiliation, owner) ->
|
affiliation, owner, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(FAffiliation, _FRole,
|
can_change_ra(FAffiliation, _FRole,
|
||||||
none, _TRole,
|
none, _TRole,
|
||||||
affiliation, outcast)
|
affiliation, outcast, _ServiceAf)
|
||||||
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(FAffiliation, _FRole,
|
can_change_ra(FAffiliation, _FRole,
|
||||||
none, _TRole,
|
none, _TRole,
|
||||||
affiliation, member)
|
affiliation, member, _ServiceAf)
|
||||||
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(owner, _FRole,
|
can_change_ra(owner, _FRole,
|
||||||
none, _TRole,
|
none, _TRole,
|
||||||
affiliation, admin) ->
|
affiliation, admin, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(owner, _FRole,
|
can_change_ra(owner, _FRole,
|
||||||
none, _TRole,
|
none, _TRole,
|
||||||
affiliation, owner) ->
|
affiliation, owner, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(FAffiliation, _FRole,
|
can_change_ra(FAffiliation, _FRole,
|
||||||
member, _TRole,
|
member, _TRole,
|
||||||
affiliation, outcast)
|
affiliation, outcast, _ServiceAf)
|
||||||
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(FAffiliation, _FRole,
|
can_change_ra(FAffiliation, _FRole,
|
||||||
member, _TRole,
|
member, _TRole,
|
||||||
affiliation, none)
|
affiliation, none, _ServiceAf)
|
||||||
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(owner, _FRole,
|
can_change_ra(owner, _FRole,
|
||||||
member, _TRole,
|
member, _TRole,
|
||||||
affiliation, admin) ->
|
affiliation, admin, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(owner, _FRole,
|
can_change_ra(owner, _FRole,
|
||||||
member, _TRole,
|
member, _TRole,
|
||||||
affiliation, owner) ->
|
affiliation, owner, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(owner, _FRole,
|
can_change_ra(owner, _FRole,
|
||||||
admin, _TRole,
|
admin, _TRole,
|
||||||
affiliation, _Affiliation) ->
|
affiliation, _Affiliation, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(owner, _FRole,
|
can_change_ra(owner, _FRole,
|
||||||
owner, _TRole,
|
owner, _TRole,
|
||||||
affiliation, _Affiliation) ->
|
affiliation, _Affiliation, _ServiceAf) ->
|
||||||
check_owner;
|
check_owner;
|
||||||
can_change_ra(_FAffiliation, _FRole,
|
can_change_ra(_FAffiliation, _FRole,
|
||||||
_TAffiliation, _TRole,
|
_TAffiliation, _TRole,
|
||||||
affiliation, _Value) ->
|
affiliation, _Value, _ServiceAf) ->
|
||||||
false;
|
false;
|
||||||
can_change_ra(_FAffiliation, moderator,
|
can_change_ra(_FAffiliation, moderator,
|
||||||
_TAffiliation, visitor,
|
_TAffiliation, visitor,
|
||||||
role, none) ->
|
role, none, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(_FAffiliation, moderator,
|
can_change_ra(_FAffiliation, moderator,
|
||||||
_TAffiliation, visitor,
|
_TAffiliation, visitor,
|
||||||
role, participant) ->
|
role, participant, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(FAffiliation, _FRole,
|
can_change_ra(FAffiliation, _FRole,
|
||||||
_TAffiliation, visitor,
|
_TAffiliation, visitor,
|
||||||
role, moderator)
|
role, moderator, _ServiceAf)
|
||||||
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(_FAffiliation, moderator,
|
can_change_ra(_FAffiliation, moderator,
|
||||||
_TAffiliation, participant,
|
_TAffiliation, participant,
|
||||||
role, none) ->
|
role, none, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(_FAffiliation, moderator,
|
can_change_ra(_FAffiliation, moderator,
|
||||||
_TAffiliation, participant,
|
_TAffiliation, participant,
|
||||||
role, visitor) ->
|
role, visitor, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(FAffiliation, _FRole,
|
can_change_ra(FAffiliation, _FRole,
|
||||||
_TAffiliation, participant,
|
_TAffiliation, participant,
|
||||||
role, moderator)
|
role, moderator, _ServiceAf)
|
||||||
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
when (FAffiliation == owner) or (FAffiliation == admin) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(_FAffiliation, _FRole,
|
can_change_ra(_FAffiliation, _FRole,
|
||||||
owner, moderator,
|
owner, moderator,
|
||||||
role, visitor) ->
|
role, visitor, _ServiceAf) ->
|
||||||
false;
|
false;
|
||||||
can_change_ra(owner, _FRole,
|
can_change_ra(owner, _FRole,
|
||||||
_TAffiliation, moderator,
|
_TAffiliation, moderator,
|
||||||
role, visitor) ->
|
role, visitor, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(_FAffiliation, _FRole,
|
can_change_ra(_FAffiliation, _FRole,
|
||||||
admin, moderator,
|
admin, moderator,
|
||||||
role, visitor) ->
|
role, visitor, _ServiceAf) ->
|
||||||
false;
|
false;
|
||||||
can_change_ra(admin, _FRole,
|
can_change_ra(admin, _FRole,
|
||||||
_TAffiliation, moderator,
|
_TAffiliation, moderator,
|
||||||
role, visitor) ->
|
role, visitor, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(_FAffiliation, _FRole,
|
can_change_ra(_FAffiliation, _FRole,
|
||||||
owner, moderator,
|
owner, moderator,
|
||||||
role, participant) ->
|
role, participant, _ServiceAf) ->
|
||||||
false;
|
false;
|
||||||
can_change_ra(owner, _FRole,
|
can_change_ra(owner, _FRole,
|
||||||
_TAffiliation, moderator,
|
_TAffiliation, moderator,
|
||||||
role, participant) ->
|
role, participant, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(_FAffiliation, _FRole,
|
can_change_ra(_FAffiliation, _FRole,
|
||||||
admin, moderator,
|
admin, moderator,
|
||||||
role, participant) ->
|
role, participant, _ServiceAf) ->
|
||||||
false;
|
false;
|
||||||
can_change_ra(admin, _FRole,
|
can_change_ra(admin, _FRole,
|
||||||
_TAffiliation, moderator,
|
_TAffiliation, moderator,
|
||||||
role, participant) ->
|
role, participant, _ServiceAf) ->
|
||||||
true;
|
true;
|
||||||
can_change_ra(_FAffiliation, _FRole,
|
can_change_ra(_FAffiliation, _FRole,
|
||||||
_TAffiliation, _TRole,
|
_TAffiliation, _TRole,
|
||||||
role, _Value) ->
|
role, _Value, _ServiceAf) ->
|
||||||
false.
|
false.
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user