DataRule enum

Who can read and write a collection.

Firestore's rules (firebase/firestore.rules) enforce each one; a rule they don't know lets no app user in, and an SDK that doesn't know a rule reads it as app, so its reads and writes are refused rather than widened.

Inheritance
Available extensions

Values

app → const DataRule

Anyone using the app. The default.

signedIn → const DataRule

Signed-in users only.

owner → const DataRule

Each signed-in user reads and writes only their own documents.

publicReadOwnerWrite → const DataRule

Anyone reads; signed-in users write their own documents.

roleWrite → const DataRule

Anyone reads; users with the collection's role write.

ownerRead → const DataRule

Each signed-in user reads only their own documents (those whose DataRules.ownerField is theirs); only the project's editors, the server and users with the collection's role (DataRules.roles, default admin) write them. The owner may change only the fields DataRules.ownerFields lists (a read flag), on an existing document.

audience → const DataRule

A user reads a document whose DataRules.audienceField list names them: everyone (DataRules.everyone), signed-in users (DataRules.signedInUsers), their role (DataRules.roleAudience) or them (DataRules.userAudience). Checked at read time, so users who sign up or change role later see what is addressed to them. Writes as ownerRead.

Properties

hashCode → int
The hash code for this object.
no setterinherited
index → int
A numeric identifier for the enumerated value.
no setterinherited
name → String

Available on Enum, provided by the EnumName extension

The name of the enum value.
no setter
readsAudience → bool
Whether reads return only the documents addressed to the reader (audience).
no setter
readsOwnOnly → bool
Whether reads return only the signed-in user's documents.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stampsOwner → bool
Whether writes record the signed-in user as the document's owner.
no setter
writeNeedsSignIn → bool
Whether writing needs a signed-in user.
no setter
writtenByRole → bool
Whether only the project's editors, the server and users with the collection's role write (besides an ownerRead owner's own fields).
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

values → const List<DataRule>
A constant List of the values in this enum, in order of their declaration.