AllowReadCollectionModelPermissionQuery.userFromData constructor

const AllowReadCollectionModelPermissionQuery.userFromData([
  1. String? key
])

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.

Null or @uid will cause a comparison with the document ID.

If allUsers or authUsers is specified, it takes precedence.

userFromPath can be specified at the same time.

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

Nullもしくは@uidを指定するとドキュメントIDとの比較が行われます。

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

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

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

Define a query to validate data permissions.

If a list exists on CollectionModelPath.permission or DocumentModelPath.permission, permissions are basically specified in white list format.

If firebase/firestore.rules exists, generate rules for Firestore.

データのパーミッションを検証するクエリを定義します。

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

firebase/firestore.rulesが存在している場合、Firestore用のルールを生成します。

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

Implementation

const AllowReadCollectionModelPermissionQuery.userFromData([String? key])
    : this._(
        permission: ModelPermissionQueryType.allowReadCollection,
        user: ModelPermissionQueryUserType.userFromData,
        key: key ?? kUidFieldKey,
      );