Security Rules for Cloud Firestore and Cloud Storage.
Functions
| Function | Description |
|---|---|
| getSecurityRules(app) | Gets the SecurityRules service for the default app or a given app.admin.securityRules() can be called with no arguments to access the default app's SecurityRules service, or as admin.securityRules(app) to access the SecurityRules service associated with a specific app. |
Classes
| Class | Description |
|---|---|
| Ruleset | A set of Firebase security rules. |
| RulesetMetadataList | A page of ruleset metadata. |
| SecurityRules | The Firebase SecurityRules service interface. |
Interfaces
| Interface | Description |
|---|---|
| RulesetMetadata | Required metadata associated with a ruleset. |
| RulesFile | A source file containing some Firebase security rules. The content includes raw source code including text formatting, indentation and comments. Use the SecurityRules.createRulesFileFromSource() method to create new instances of this type. |
getSecurityRules(app)
Gets the SecurityRules service for the default app or a given app.
admin.securityRules() can be called with no arguments to access the default app's SecurityRules service, or as admin.securityRules(app) to access the SecurityRules service associated with a specific app.
Signature:
export declare function getSecurityRules(app?: App): SecurityRules;
Parameters
| Parameter | Type | Description |
|---|---|---|
| app | App | Optional app to return the SecurityRules service for. If not provided, the default SecurityRules service is returned. |
Returns:
The default SecurityRules service if no app is provided, or the SecurityRules service associated with the provided app.
Example 1
// Get the SecurityRules service for the default app
const defaultSecurityRules = getSecurityRules();
Example 2
// Get the SecurityRules service for a given app
const otherSecurityRules = getSecurityRules(otherApp);