在 Appcelerator 中更新用户(不是登录用户)
Updating a User (not the logged in User) in Appcelerator
我想启用管理员。用户更新用户信息(例如名字、姓氏等)我有一个用户列表视图...当管理员用户选择要更新的用户之一时,会显示详细信息,但实际更新应用于管理员用户。不是我要更新的用户。
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
Update the current user.
这应该可以解释为什么您的代码正在更新管理员用户。
但是我也找到了in the documentation for Users: Update Current User下面的参数
su_id : String [ADMIN-ONLY]
User ID to update this user on behalf of.
The current login user must be an application admin to update a user
on behalf of another user.
我会试试的。 (顺便说一句,我没用过,但还是希望对你有帮助)
我想启用管理员。用户更新用户信息(例如名字、姓氏等)我有一个用户列表视图...当管理员用户选择要更新的用户之一时,会显示详细信息,但实际更新应用于管理员用户。不是我要更新的用户。
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
Update the current user.
这应该可以解释为什么您的代码正在更新管理员用户。
但是我也找到了in the documentation for Users: Update Current User下面的参数
su_id : String [ADMIN-ONLY]
User ID to update this user on behalf of. The current login user must be an application admin to update a user on behalf of another user.
我会试试的。 (顺便说一句,我没用过,但还是希望对你有帮助)