]> granicus.if.org Git - ejabberd/commitdiff
* src/mod_muc/mod_muc_room.erl: Bugfix
authorAlexey Shchepin <alexey@process-one.net>
Mon, 6 Mar 2006 02:30:15 +0000 (02:30 +0000)
committerAlexey Shchepin <alexey@process-one.net>
Mon, 6 Mar 2006 02:30:15 +0000 (02:30 +0000)
SVN Revision: 516

ChangeLog
src/mod_muc/mod_muc_room.erl

index 2cff6e91b352aeefdd3bc79c24214f4606727db3..a285ac1432741f59ec46db1a5c8ee5adf6c34b4e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-03-06  Alexey Shchepin  <alexey@sevcom.net>
+
+       * src/mod_muc/mod_muc_room.erl: Bugfix
+
 2006-03-05  Alexey Shchepin  <alexey@sevcom.net>
 
        * src/ejabberd_c2s.erl: Bugfix
index 51c2d2d197aa1aac7b0233f437ac997aa173e4f2..a31443f4859a258c3e41f509ed154c2b04b0b81e 100644 (file)
@@ -1684,10 +1684,28 @@ find_changed_items(UJID, UAffiliation, URole,
                                            [StrAffiliation]),
                                    {error, ?ERRT_NOT_ACCEPTABLE(Lang, ErrText1)};
                                SAffiliation ->
-                                   case can_change_ra(
-                                          UAffiliation, URole,
-                                          TAffiliation, TRole,
-                                          affiliation, SAffiliation) of
+                                   CanChangeRA =
+                                       case can_change_ra(
+                                              UAffiliation, URole,
+                                              TAffiliation, TRole,
+                                              affiliation, SAffiliation) of
+                                           nothing ->
+                                               nothing;
+                                           true ->
+                                               true;
+                                           check_owner ->
+                                               case search_affiliation(
+                                                      owner, StateData) of
+                                                   [{OJID, _}] ->
+                                                       jlib:jid_remove_resource(OJID) /=
+                                                           jlib:jid_tolower(jlib:jid_remove_resource(UJID));
+                                                   _ ->
+                                                       true
+                                               end;
+                                           _ ->
+                                               false
+                                       end,
+                                   case CanChangeRA of
                                        nothing ->
                                            find_changed_items(
                                              UJID,
@@ -1705,7 +1723,7 @@ find_changed_items(UJID, UAffiliation, URole,
                                                xml:get_path_s(
                                                  Item, [{elem, "reason"},
                                                         cdata])} | Res]);
-                                       _ ->
+                                       false ->
                                            {error, ?ERR_NOT_ALLOWED}
                                    end
                            end
@@ -1721,10 +1739,28 @@ find_changed_items(UJID, UAffiliation, URole,
                                  [StrRole]),
                            {error, ?ERRT_BAD_REQUEST(Lang, ErrText1)};
                        SRole ->
-                           case can_change_ra(
-                                  UAffiliation, URole,
-                                  TAffiliation, TRole,
-                                  role, SRole) of
+                           CanChangeRA =
+                               case can_change_ra(
+                                      UAffiliation, URole,
+                                      TAffiliation, TRole,
+                                      role, SRole) of
+                                   nothing ->
+                                       nothing;
+                                   true ->
+                                       true;
+                                   check_owner ->
+                                       case search_affiliation(
+                                              owner, StateData) of
+                                           [{OJID, _}] ->
+                                               jlib:jid_remove_resource(OJID) /=
+                                                   jlib:jid_tolower(jlib:jid_remove_resource(UJID));
+                                           _ ->
+                                               true
+                                       end;
+                                   _ ->
+                                       false
+                           end,
+                           case CanChangeRA of
                                nothing ->
                                    find_changed_items(
                                      UJID,
@@ -1824,7 +1860,7 @@ can_change_ra(owner, _FRole,
 can_change_ra(owner, _FRole,
              owner, _TRole,
              affiliation, _Affiliation) ->
-    true;
+    check_owner;
 can_change_ra(_FAffiliation, _FRole,
              _TAffiliation, _TRole,
              affiliation, _Value) ->