User platform role modification fix
authorLaurence Maultsby <laurence.maultsby@riftio.com>
Wed, 12 Apr 2017 18:14:06 +0000 (14:14 -0400)
committerLaurence Maultsby <laurence.maultsby@riftio.com>
Wed, 12 Apr 2017 18:14:06 +0000 (14:14 -0400)
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
skyquake/framework/core/modules/api/projectManagementAPI.js
skyquake/plugins/user_management/src/platformRoleManagement/platformRoleManagement.jsx
skyquake/plugins/user_management/src/platformRoleManagement/platformRoleManagementSource.js
skyquake/plugins/user_management/src/platformRoleManagement/platformRoleManagementStore.js

index 07e873d..c00de32 100644 (file)
@@ -228,6 +228,7 @@ ProjectManagement.updatePlatform = function(req) {
     var api_server = req.query['api_server'];
     var bodyData = req.body;
     data = bodyData;
+    data.user = JSON.parse(data.user)
     var updateTasks = [];
 
     var updateUser = rp({
index 761ce0d..de5064b 100644 (file)
@@ -94,7 +94,7 @@ class PlatformRoleManagement extends React.Component {
 
 
         this.Store.updatePlatform({
-                'user': platformUsers
+                'user': JSON.stringify(platformUsers)
             }
         );
     }
index 2e1f3c0..724312e 100644 (file)
@@ -80,6 +80,7 @@ module.exports = function(Alt) {
                   url: `/platform?api_server=${API_SERVER}`,
                   type: 'PUT',
                   data: project,
+                  dataType: 'json',
                   beforeSend: Utils.addAuthorizationStub,
                   success: function(data, textStatus, jqXHR) {
                     resolve(data);
index 326f13a..ef03b9d 100644 (file)
@@ -173,7 +173,7 @@ export default class PlatformRoleManagementStore {
             })
         } else {
             let role = platformUsers[userIndex].role;
-            platformUsers[userIndex].role.splice(roleIndex, 1)
+            platformUsers[userIndex].role.splice(_.findIndex(role, function(r) { return r.role == selectedRole; }), 1)
         }
        self.setState({platformUsers});