summary refs log tree commit diff
path: root/webclient/components
diff options
context:
space:
mode:
authorEmmanuel ROHEE <erohee@amdocs.com>2014-09-03 18:33:36 +0200
committerEmmanuel ROHEE <erohee@amdocs.com>2014-09-03 18:33:51 +0200
commit5dd1a738f8dcd18176e606249fc461d4197d0d71 (patch)
tree1cd5ca4f939b7f596b47f5ff5f745ec723cbfc38 /webclient/components
parentfix the copyright holder from matrix.org to OpenMarket Ltd, as matrix.org has... (diff)
downloadsynapse-5dd1a738f8dcd18176e606249fc461d4197d0d71.tar.xz
Use /rooms/$room_id/state/m.room.member/$user_id to change the membership of another user
Diffstat (limited to 'webclient/components')
-rw-r--r--webclient/components/matrix/matrix-service.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/webclient/components/matrix/matrix-service.js b/webclient/components/matrix/matrix-service.js
index a0674d06c9..165930fbc1 100644
--- a/webclient/components/matrix/matrix-service.js
+++ b/webclient/components/matrix/matrix-service.js
@@ -165,13 +165,25 @@ angular.module('matrixService', [])
             // TODO: Use PUT with transaction IDs
             return doRequest("POST", path, undefined, data);
         },
+
+        // Change the membership of an another user
+        setMembership: function(room_id, user_id, membershipValue) {
+            // The REST path spec
+            var path = "/rooms/$room_id/state/m.room.member/$user_id";
+            path = path.replace("$room_id", encodeURIComponent(room_id));
+            path = path.replace("$user_id", user_id);
+
+            return doRequest("PUT", path, undefined, {
+                membership: membershipValue
+            });
+        },
            
         // Bans a user from from a room
         ban: function(room_id, user_id, reason) {
             var path = "/rooms/$room_id/ban/";
             path = path.replace("$room_id", encodeURIComponent(room_id));
             
-            return doRequest("PUT", path, undefined, {
+            return doRequest("POST", path, undefined, {
                 user_id: user_id,
                 reason: reason
             });