AllowReadDocumentModelPermissionQuery.userFromData constructor
- 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との比較が行われます。
allUsersやauthUsersが指定されている場合はそちらが優先されます。
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.permissionやDocumentModelPath.permission上のでリストが存在している場合、基本的にはホワイトリスト形式でパーミッションが指定されます。
firebase/firestore.rules
が存在している場合、Firestore用のルールを生成します。
permissionやuserを指定して許可をする属性を指定できます。
Implementation
const AllowReadDocumentModelPermissionQuery.userFromData([String? key])
: this._(
permission: ModelPermissionQueryType.allowReadDocument,
user: ModelPermissionQueryUserType.userFromData,
key: key ?? kUidFieldKey,
);