firebase-admin.security-rules package
Stay organized with collections
Save and categorize content based on your preferences.
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
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:
SecurityRules
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);
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-16 UTC.
[null,null,["Last updated 2024-04-16 UTC."],[],[],null,["# firebase-admin.security-rules package\n\nSecurity Rules for Cloud Firestore and Cloud Storage.\n\nFunctions\n---------\n\n| Function | Description |\n|--------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [getSecurityRules(app)](./firebase-admin.security-rules.md#getsecurityrules_8a40afc) | Gets the [SecurityRules](./firebase-admin.security-rules.securityrules.md#securityrules_class) 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. |\n\nClasses\n-------\n\n| Class | Description |\n|---------------------------------------------------------------------------------------------------------|-------------------------------------------------|\n| [Ruleset](./firebase-admin.security-rules.ruleset.md#ruleset_class) | A set of Firebase security rules. |\n| [RulesetMetadataList](./firebase-admin.security-rules.rulesetmetadatalist.md#rulesetmetadatalist_class) | A page of ruleset metadata. |\n| [SecurityRules](./firebase-admin.security-rules.securityrules.md#securityrules_class) | The Firebase `SecurityRules` service interface. |\n\nInterfaces\n----------\n\n| Interface | Description |\n|-------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [RulesetMetadata](./firebase-admin.security-rules.rulesetmetadata.md#rulesetmetadata_interface) | Required metadata associated with a ruleset. |\n| [RulesFile](./firebase-admin.security-rules.rulesfile.md#rulesfile_interface) | A source file containing some Firebase security rules. The content includes raw source code including text formatting, indentation and comments. Use the [SecurityRules.createRulesFileFromSource()](./firebase-admin.security-rules.securityrules.md#securityrulescreaterulesfilefromsource) method to create new instances of this type. |\n\ngetSecurityRules(app)\n---------------------\n\nGets the [SecurityRules](./firebase-admin.security-rules.securityrules.md#securityrules_class) service for the default app or a given app.\n\n`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.\n\n**Signature:** \n\n export declare function getSecurityRules(app?: App): SecurityRules;\n\n### Parameters\n\n| Parameter | Type | Description |\n|-----------|------|---------------------------------------------------------------------------------------------------------------------------|\n| app | App | Optional app to return the `SecurityRules` service for. If not provided, the default `SecurityRules` service is returned. |\n\n**Returns:**\n\n[SecurityRules](./firebase-admin.security-rules.securityrules.md#securityrules_class)\n\nThe default `SecurityRules` service if no app is provided, or the `SecurityRules` service associated with the provided app.\n\n### Example 1\n\n // Get the SecurityRules service for the default app\n const defaultSecurityRules = getSecurityRules();\n\n### Example 2\n\n // Get the SecurityRules service for a given app\n const otherSecurityRules = getSecurityRules(otherApp);"]]