firebase-admin.security-rules package

Security Rules for Cloud Firestore and Cloud Storage.

Functions

FunctionDescription
getSecurityRules(app)Gets theSecurityRules service for the default app or a given app.admin.securityRules() can be called with no arguments to access the default app'sSecurityRules service, or asadmin.securityRules(app) to access theSecurityRules service associated with a specific app.

Classes

ClassDescription
RulesetA set of Firebase security rules.
RulesetMetadataListA page of ruleset metadata.
SecurityRulesThe FirebaseSecurityRules service interface.

Interfaces

InterfaceDescription
RulesetMetadataRequired metadata associated with a ruleset.
RulesFileA source file containing some Firebase security rules. The content includes raw source code including text formatting, indentation and comments. Use theSecurityRules.createRulesFileFromSource() method to create new instances of this type.

getSecurityRules(app)

Gets theSecurityRules service for the default app or a given app.

admin.securityRules() can be called with no arguments to access the default app'sSecurityRules service, or asadmin.securityRules(app) to access theSecurityRules service associated with a specific app.

Signature:

exportdeclarefunctiongetSecurityRules(app?:App):SecurityRules;

Parameters

ParameterTypeDescription
appAppOptional app to return theSecurityRules service for. If not provided, the defaultSecurityRules service is returned.

Returns:

SecurityRules

The defaultSecurityRules service if no app is provided, or theSecurityRules service associated with the provided app.

Example 1

// Get the SecurityRules service for the default appconstdefaultSecurityRules=getSecurityRules();

Example 2

// Get the SecurityRules service for a given appconstotherSecurityRules=getSecurityRules(otherApp);

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-04-16 UTC.