AllowReadModelPermissionQuery.userFromPath constructor

const AllowReadModelPermissionQuery.userFromPath([
  1. String? key
])

An authenticated user whose user ID matches the dynamic value specified by :key in the document or collection path and the user ID authenticated on the app.

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

If allUsers or authUsers is specified, it takes precedence.

userFromData can be specified at the same time.

認証済みユーザーのうち、ドキュメントやコレクションのパス中の:keyで指定する動的な値とアプリ上で認証しているユーザーIDが一致するユーザー。

Nullを指定するとドキュメントIDとの比較が行われます。

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

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

// Path definition
/collection/:document_id
// Actual path
/collection/ABCDEFG
// Definition
ModelPermissionQueryUserType.userFromPath("document_id")
-> 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 AllowReadModelPermissionQuery.userFromPath([String? key])
    : this._(
        permission: ModelPermissionQueryType.allowRead,
        user: ModelPermissionQueryUserType.userFromPath,
        key: key ?? kUidFieldKey,
      );