コンテンツにスキップ

$fn.createUser(param)

アプリケーションの認証ユーザを追加します。[非同期]

引数

名前説明
paramobject登録するユーザ情報

param詳細

プロパティ説明
emailstringEメール(サインインIDに使用する文字列)
namestring名前
passwordstring一時パスワード
sendMailbooleantrue:発行メール送信する
false:発行メール送信しない
デフォルトはfalse
custom_01stringカスタム属性1
custom_02stringカスタム属性2
custom_03stringカスタム属性3
custom_04stringカスタム属性4
custom_05stringカスタム属性5
custom_06stringカスタム属性6
custom_07stringカスタム属性7
custom_08stringカスタム属性8
custom_09stringカスタム属性9
custom_10stringカスタム属性10

戻り値

説明
Promise<User>登録したユーザ情報
オブジェクトプロパティ説明
UseruserIdstringユーザID (GUID)
emailstringEメール
namestring名前
custom_01stringカスタム属性1
custom_02stringカスタム属性2
custom_03stringカスタム属性3
custom_04stringカスタム属性4
custom_05stringカスタム属性5
custom_06stringカスタム属性6
custom_07stringカスタム属性7
custom_08stringカスタム属性8
custom_09stringカスタム属性9
custom_10stringカスタム属性10
enabledboolean有効/無効
createdstring作成日時
updatedstring更新日時
statusstringユーザのステータス

サンプル

try {
/* CSV の内容
* ------------------------------------------------------
* "email","name","password","sendMail"
* "user01@test.co.jp","User01","Password@01",true
* "user02@test.co.jp","User02","Password@02",false
* ------------------------------------------------------
*/
const file = await $fn.getFile('/userInfo.csv');
const buffer = file.data;
const userInfos = $fn.csvToObject(buffer);
for (let userInfo of userInfos) {
console.log(JSON.stringify(userInfo));
let data = {};
data = {
email: userInfo['email'],
name: userInfo['name'],
password: userInfo['password'],
sendMail: JSON.parse(userInfo['sendMail'])
};
// ユーザ追加
let result=await $fn.createUser(data);
if(result.errorType){
throw new Error (result.errorMessage);
}
}
} catch(err) {
console.log("Error", err.message);
}