{ "id": "148990", "key": "AC-173", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2015-11-13T19:25:21.000+0000", "created": "2015-06-22T14:07:31.000+0000", "labels": [], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2015-11-13T19:25:21.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14559", "name": "ArrowDB" } ], "description": "there seems to be a bug in Cloud.Objects.create when using arrowdb on appcelerator cluster. In the code below I login as an admin and create data for another user but the data is created for the admin which is wrong. Look at the log output and the resulting user id. Seems like the user_id field of Cloud.Objects.create is not read correctly.\r\nWith my old project where data is still hosted on titanium cluster this bug does not appear!\r\n\r\ntest code:\r\n\r\nvar Cloud = require('ti.cloud');\r\nvar userData = {\r\n login: 'server',\r\n password: 'password',\r\n};\r\n \r\nCloud.Users.login(userData, function (e) {\r\n if (e.success) {\r\n console.log(\"login successful\");\r\n var adminUser = e.users[0];\r\n console.log('admin: '+adminUser.admin + ' id:'+adminUser.id);\r\n Cloud.Users.create({\r\n username: 'test',\r\n password: 'test',\r\n password_confirmation: 'test'\r\n }, function (e) {\r\n if (e.success) {\r\n var user = e.users[0];\r\n console.log('Success:\\n' +\r\n 'id of other user test: ' + user.id + '\\n');\r\n Cloud.Objects.create({classname: 'testData', user_id:user.id, fields:{data1:0,data2:1}},function (e) {\r\n if (e.success) {\r\n console.log('Create Success:\\n' +e.testData.length);\r\n console.log(JSON.stringify(e.testData)); \r\n } else {\r\n alert('Error:\\n' +\r\n ((e.error && e.message) || JSON.stringify(e)));\r\n }\r\n }); \r\n } else {\r\n console.log('Error:\\n' +\r\n ((e.error && e.message) || JSON.stringify(e)));\r\n }\r\n });\r\n } else {\r\n console.log(\"login failed \"+JSON.stringify(e)); \r\n }\r\n}); \r\n\r\nBug on appcelerator cluster: user id of cloud data is not equal to id of created user:\r\nlogin successful\r\n[INFO] : admin: true id:557212af730b8233ab009a7f\r\n[INFO] : Success:\r\n[INFO] : id of other user test: 55851f1e7ed7bb0b591490bd\r\n[INFO] : \r\n[INFO] : Create Success:\r\n[INFO] : 1\r\n[INFO] : [{\"user_id\":\"557212af730b8233ab009a7f\",\"created_at\":\"2015-06-20T08:06:55+0000\",\"updated_at\":\"2015-06-20T08:06:55+0000\",\"data1\":0,\"data2\":1,\"id\":\"55851f1f1b40070b91146ad7\"}]\r\n\r\nNo bug on titanium cluster: user id of cloud data is equal to id of created user\r\n[INFO] : admin: true id:543b75f3c7b8a7398c01abe3\r\n[INFO] : Success:\r\n[INFO] : id of other user test: 55851d58da3c52099007589a\r\n[INFO] : \r\n[INFO] : Create Success:\r\n[INFO] : 1\r\n[INFO] : [{\"created_at\":\"2015-06-20T07:59:20+0000\",\"updated_at\":\"2015-06-20T07:59:20+0000\",\"data1\":0,\"data2\":1,\"id\":\"55851d58591153097528fd76\",\"user\":{\"id\":\"55851d58da3c52099007589a\",\"created_at\":\"2015-06-20T07:59:20+0000\",\"updated_at\":\"2015-06-20T07:59:20+0000\",\"external_accounts\":[],\"confirmed_at\":\"2015-06-20T07:59:20+0000\",\"username\":\"test678\",\"admin\":\"false\",\"stats\":{\"photos\":{\"total_count\":0},\"storage\":{\"used\":0}},\"friend_counts\":{\"requests\":0,\"following\":0,\"friends\":0,\"followers\":0}}}]\r\n", "attachment": [], "flagged": false, "summary": "Creating Custom Object for another user does not work", "creator": { "name": "mraalex", "key": "mraalex", "displayName": "Alexander Rieger", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "mraalex", "key": "mraalex", "displayName": "Alexander Rieger", "active": true, "timeZone": "Europe/Berlin" }, "environment": "iOS Simulator 4s\r\n 4.0.0.GA", "comment": { "comments": [ { "id": "355724", "author": { "name": "mraalex", "key": "mraalex", "displayName": "Alexander Rieger", "active": true, "timeZone": "Europe/Berlin" }, "body": "I saw now on docs that parameter name has changed:\r\n\r\nsu_id : String ADMIN-ONLY\r\nUser ID to create the object on behalf of.\r\n\r\nThe current login user must be an application admin to create an object on behalf of another user.\r\n\r\nI tested this successfully. Therefore the issue can be marked as resolved.", "updateAuthor": { "name": "mraalex", "key": "mraalex", "displayName": "Alexander Rieger", "active": true, "timeZone": "Europe/Berlin" }, "created": "2015-06-23T06:11:15.000+0000", "updated": "2015-06-23T06:11:15.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }