我有一个基于Authentication和的颤振应用程序,我通过 firebase添加了用户(蓝色按钮),并在代码中保留了ID,以便这个用户是administrator,的常规用户可以通过应用程序创建一个帐户(电子邮件和密码),我想要的是确保administrator是唯一可以从数据库中删除数据的人,而其他用户只允许读写,所以我这样做了:
我将CloudFi还原项目中的角色更改为:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match
我目前有安全规则,允许用户只从名为"153“的集合中读取。
在Android中,我访问Firestore并调用Firestore实例上的.collection("153").get()...从该集合中检索数据。
相反,如果Android代码读取.collection("999").get...,则该权限将被拒绝,这是应该的。
安全规则:
service cloud.firestore {
match /databases/{database}/documents {
// FULL ADMIN ACCESS
match /{docum
我正在注册为第一个用户。
如何将管理员角色仅添加到Firebase Firestore数据库中的第一个用户?
const auth = firebase.auth();
const db = firebase.firestore();
// sign up the user
auth.createUserWithEmailAndPassword(email, password).then((cred) => {
// set admin to true for the only first user
return db.collecti
因此,我正在我的应用程序中构建一个用户配置文件,并保存在Firestore数据库中创建的名称、Bio、Image、uid和date。当其他值保存在数据库中并在用户配置文件中检索时,imageurl被保存为空字符串,因此不会在用户配置文件中检索。我哪里出问题了?
import SwiftUI
import Firebase
class RegisterViewModel : ObservableObject{
@Published var name = ""
@Published var bio = ""
@Publi
我的Firestore数据库中有以下规则。但是,我仍然不断收到Firestore的通知,说我在数据库中设置的规则是不安全的。请看下面的代码。有什么建议或建议使数据库更安全吗?
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read: if true;
allow write: if userIsAdmin();
}
match /Basket/{Basket}
每当新用户注册到我的应用程序时,我的Firestore数据库都会创建一个新的Collection。集合的名称是新用户的用户名。我想让这个集合中的文档具有受限的写访问权限。
service cloud.firestore {
match /databases/{database}/documents {
match /User1/{info} {
allow read: if signedIn();
allow write: if isOwner(User1);
}
function signedIn() {
return
我正在使用Dart,Flutter和Firebase制作一个应用程序。有注册/登录,我使用云firestore作为数据库。在我的云firestore中,用户UID是文档id,我有每个用户的特定数据(结果)。 我只想检索当前用户的数据(存储在Firestore中)并显示在屏幕上。This is my cloud firestore image void submitit(double n, m) async {
final FirebaseUser user = await FirebaseAuth.instance.currentUser();
final String usr = user