$fn.createUser(param)
アプリケーションの認証ユーザを追加します。[非同期]
引数
名前 | 型 | 説明 |
---|---|---|
param | object | 登録するユーザ情報 |
param詳細
プロパティ | 型 | 説明 |
---|---|---|
string | Eメール(サインインIDに使用する文字列) | |
name | string | 名前 |
password | string | 一時パスワード |
sendMail | boolean | true:発行メール送信する false:発行メール送信しない デフォルトはfalse |
custom_01 | string | カスタム属性1 |
custom_02 | string | カスタム属性2 |
custom_03 | string | カスタム属性3 |
custom_04 | string | カスタム属性4 |
custom_05 | string | カスタム属性5 |
custom_06 | string | カスタム属性6 |
custom_07 | string | カスタム属性7 |
custom_08 | string | カスタム属性8 |
custom_09 | string | カスタム属性9 |
custom_10 | string | カスタム属性10 |
戻り値
型 | 説明 |
---|---|
Promise<User> | 登録したユーザ情報 |
オブジェクト | プロパティ | 型 | 説明 |
---|---|---|---|
User | userId | string | ユーザID (GUID) |
string | Eメール | ||
name | string | 名前 | |
custom_01 | string | カスタム属性1 | |
custom_02 | string | カスタム属性2 | |
custom_03 | string | カスタム属性3 | |
custom_04 | string | カスタム属性4 | |
custom_05 | string | カスタム属性5 | |
custom_06 | string | カスタム属性6 | |
custom_07 | string | カスタム属性7 | |
custom_08 | string | カスタム属性8 | |
custom_09 | string | カスタム属性9 | |
custom_10 | string | カスタム属性10 | |
enabled | boolean | 有効/無効 | |
created | string | 作成日時 | |
updated | string | 更新日時 | |
status | string | ユーザのステータス |
サンプル
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);}