AllowReadModelValidationQuery.userFromData constructor

const AllowReadModelValidationQuery.userFromData(
  1. String key
)

Allow all reads (documents and collections).

読み込み(ドキュメントおよびコレクション)をすべて許可します。

An authenticated user whose user ID matches the value of a field with key in the document to be read or written and the user ID authenticated on the app.

If @uid is specified, a comparison with the document ID is performed.

If allUsers or authUsers is specified, it takes precedence.

userFromPathIndex can be specified at the same time.

認証済みユーザーのうち、読み込みや書き込み対象のドキュメント中にkeyを持つフィールドの値ととアプリ上で認証しているユーザーIDが一致するユーザー。

@uidが指定されている場合ドキュメントIDとの比較が行われます。

allUsersauthUsersが指定されている場合はそちらが優先されます。

userFromPathIndexとは同時に指定可能です。

// Document data
{
  "user": "ABCDEFG",
  "name": "ABCD",
  "age": 20,
}
// Definition
ModelValidationQueryUserType.userFromData("user")
-> Allow users whose user ID is `ABCDEFG

Define the validation query to be used by DatabaseValidator.

Basically, if a listing exists on ModelQuery, permissions are specified in a white list format.

You can specify attributes to allow by specifying permission or user.

DatabaseValidatorで使用するバリデーションクエリを定義します。

基本的にはModelQuery上でリストが存在している場合、ホワイトリスト形式でパーミッションが指定されます。

permissionuserを指定して許可をする属性を指定できます。

Implementation

const AllowReadModelValidationQuery.userFromData(String key)
    : this._(
        permission: ModelValidationQueryPermissionType.allowRead,
        user: ModelValidationQueryUserType.userFromData,
        key: key,
      );