简体   繁体   English

在Appcelerator中更新用户(不是已登录的用户)

[英]Updating a User (not the logged in User) in Appcelerator

I want to enable an admin. 我要启用管理员。 user to update User info (eg First Name, Last Name, etc.) I have a List View of Users...when admin User selects one of the Users to update, details are shown, but actual update is applied to Admin User. 要更新用户信息的用户(例如名字,姓氏等)我有一个用户列表视图...当admin用户选择其中一个要更新的用户时,会显示详细信息,但实际更新将应用于Admin User。 Not the User I'm trying to Update. 不是我要更新的用户。

function updateUser() {
   Cloud.Users.update({
       // Id of User to Update
       id : userId,
       first_name : firstNameValue.value,
       last_name : lastNameValue.value,
   }, function(e) {
       if (e.success) {
           var user = e.users[0];
           //alert('Success:\n' + 'id: ' + user.id + '\n' + 'first name: ' + user.first_name + '\n' + 'last name: ' + user.last_name);
       } else {
           alert('Error:\n' + ((e.error && e.message) || JSON.stringify(e)));
       }
   });
};

As stated in the docs , Cloud.User.update 如文档中所述Cloud.User.update

Update the current user. 更新当前用户。

This should explain why your code is updating the admin user. 这应该可以解释您的代码为何要更新admin用户。

But I also found in the documentation for Users: Update Current User the following parameter 但是我还在用户文档中找到了:更新当前用户以下参数

su_id : String [ ADMIN-ONLY ] su_id :字符串[ 仅ADMIN ]

User ID to update this user on behalf of. 用户ID代表更新此用户。 The current login user must be an application admin to update a user on behalf of another user. 当前登录用户必须是应用程序管理员,才能代表另一个用户更新用户。

I would try with it. 我会尝试的。 (BTW I never used it, but still I hope it could help you) (顺便说一句,我从未使用过它,但我仍然希望它能对您有所帮助)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM