> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base44.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Users モジュール

> `base44.users` を介してアプリにユーザーを招待します。

<Warning>
  このページは AI コーディングエージェントスキルの一部で、人間ではなくエージェント向けに書かれています。人間向けの Base44 ドキュメントは [デベロッパードキュメント](/developers) を参照してください。
</Warning>

# Users モジュール

`base44.users` を介してアプリにユーザーを招待します。

## 目次

* [メソッド](#methods)
* [例](#examples) (ユーザーの招待)
* [ロール](#roles)
* [注意事項](#notes)

## メソッド

| メソッド                           | シグネチャ          | 説明          |
| ------------------------------ | -------------- | ----------- |
| `inviteUser(user_email, role)` | `Promise<any>` | ユーザーをアプリに招待 |

## 例

### ユーザーの招待

```javascript theme={null}
// Invite a user with "user" role
await base44.users.inviteUser("newuser@example.com", "user");

// Invite an admin
await base44.users.inviteUser("admin@example.com", "admin");
```

### 複数ユーザーの招待

```javascript theme={null}
const usersToInvite = [
  { email: "user1@example.com", role: "user" },
  { email: "user2@example.com", role: "user" },
  { email: "manager@example.com", role: "admin" }
];

for (const user of usersToInvite) {
  await base44.users.inviteUser(user.email, user.role);
  console.log(`Invited ${user.email} as ${user.role}`);
}
```

## ロール

`role` パラメーターは以下のいずれかである必要があります:

| ロール       | 説明                |
| --------- | ----------------- |
| `"user"`  | デフォルトの権限を持つ標準ユーザー |
| `"admin"` | 昇格された権限を持つ管理者     |

**注意:** `"user"` と `"admin"` のみが有効なロール値です。他の値を渡すとエラーがスローされます。

## 注意事項

* **メール招待**: 招待されたユーザーはアプリに参加するためのリンクを含むメールを受信します
* **重複処理**: 既存のユーザーを招待すると招待が再送信されます
* **auth でも利用可能**: `base44.auth.inviteUser()` は同じ機能を提供します
* **ロール検証**: `"user"` または `"admin"` のみ受け入れられます

```javascript theme={null}
// These are equivalent:
await base44.users.inviteUser("newuser@example.com", "user");
await base44.auth.inviteUser("newuser@example.com", "user");
```

## 型定義

```typescript theme={null}
/** Users module for inviting users to the app. */
interface UsersModule {
  /**
   * Invite a user to the application.
   * @param user_email - User's email address.
   * @param role - User's role ('user' or 'admin').
   * @returns Promise resolving when the invitation is sent.
   * @throws Error if role is not 'user' or 'admin'.
   */
  inviteUser(user_email: string, role: "user" | "admin"): Promise<any>;
}
```

<Note>このページは AI を使用して翻訳されました。最も正確で最新の情報については、[英語版](/) を参照してください。 </Note>
