Firebase 哪种firestore规则可以在flutter中显示包含我的uid的所有文档?

Firebase 哪种firestore规则可以在flutter中显示包含我的uid的所有文档?,firebase,flutter,google-cloud-firestore,firebase-security,Firebase,Flutter,Google Cloud Firestore,Firebase Security,我正在构建一个将数据保存在CloudFireStore中的应用程序 在firestore a中有一个名为projects的集合,我在其中保存了一个带有用户ID的数组。 在我的应用程序中,我想用我的用户ID显示和编辑所有项目 你能给我一个规定这个条件的规则吗 我在firebase的测试环境中测试了一些规则,但在我的应用程序中没有。 我的权限总是有问题 请询问您是否需要更多信息 我的规则: service cloud.firestore { match /databases/{database

我正在构建一个将数据保存在CloudFireStore中的应用程序

在firestore a中有一个名为projects的集合,我在其中保存了一个带有
用户ID的数组。
在我的应用程序中,我想用我的
用户ID
显示和编辑所有项目

你能给我一个规定这个条件的规则吗

我在firebase的测试环境中测试了一些规则,但在我的应用程序中没有。 我的权限总是有问题

请询问您是否需要更多信息

我的规则:

service cloud.firestore {
   match /databases/{database}/documents {


      match /projects/{projectsId} {
         allow create: if request.auth != null;
         allow read, update, delete, write: if request.auth.uid in        get(/databases/$(database)/documents/projects/$(projectsId)).data.member
         }

      match /user/{userId} {
         allow create, read: if request.auth != null;
        }
  }

 }
成员是每个项目中的一个数组

我的代码(流):

//获取项目流
流获取项目{
返回projectCollection.snapshots().map(_projectListFromSnapshot);
}
//快照中的项目列表
列表\u projectListFromSnapshot(QuerySnapshot快照){
返回snapshot.docs.map((doc){
返回项目(
名称:doc.data(),
主题:doc.data(),
成员:doc.data(),
日期:doc.data(),
projectID:doc.id,
打开:doc.data(),
);
}).toList();
}

使用
StreamProvider
,我用
列表中的每个对象构建了一个
列表视图。此规则仅用于添加/编辑/更新数据库,

service cloud.firestore {
  match /databases/{database}/documents {
    // Allow only authenticated content owners access
    match /some_collection/{document} {
      allow read, write: if request.auth.uid != null;
      }
    }
  }
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}
2。此规则适用于所有人,即添加/编辑/更新数据库而无需验证,

service cloud.firestore {
  match /databases/{database}/documents {
    // Allow only authenticated content owners access
    match /some_collection/{document} {
      allow read, write: if request.auth.uid != null;
      }
    }
  }
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}

1。此规则仅用于添加/编辑/更新数据库,

service cloud.firestore {
  match /databases/{database}/documents {
    // Allow only authenticated content owners access
    match /some_collection/{document} {
      allow read, write: if request.auth.uid != null;
      }
    }
  }
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}
2。此规则适用于所有人,即添加/编辑/更新数据库而无需验证,

service cloud.firestore {
  match /databases/{database}/documents {
    // Allow only authenticated content owners access
    match /some_collection/{document} {
      allow read, write: if request.auth.uid != null;
      }
    }
  }
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}
在测试环境中工作

在Android Studio(Flatter)中,我收到一个错误:

════════ Exception caught by provider ══════════════════════════════════════════════════════════════
The following assertion was thrown:
An exception was throw by _MapStream<QuerySnapshot, List<Project>> listened by

StreamProvider<List<Project>>, but no `catchError` was provided.

Exception:
[cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.

════════════════════════════════════════════════════════════════════════════════════════════════════
Reloaded 0 of 643 libraries in 649ms.
W/Firestore( 4590): (22.0.0) [Firestore]: Listen for Query(target=Query(projects order by __name__);limitType=LIMIT_TO_FIRST) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}

══╡ EXCEPTION CAUGHT BY PROVIDER ╞══════════════════════════════════════════════════════════════════
The following assertion was thrown:
An exception was throw by _MapStream<QuerySnapshot, List<Project>> listened by
StreamProvider<List<Project>>, but no `catchError` was provided.

Exception:
[cloud_firestore/permission-denied] The caller does not have permission to execute the specified
operation.

════════════════════════════════════════════════════════════════════════════════════════════════════
════════ 提供程序捕获到异常══════════════════════════════════════════════════════════════
引发了以下断言:
所侦听的映射流引发了异常
StreamProvider,但未提供“catchError”。
例外情况:
[cloud_firestore/权限被拒绝]调用方没有执行指定操作的权限。
════════════════════════════════════════════════════════════════════════════════════════════════════
在649毫秒内重新加载了643个库中的0个。
W/Firestore(4590):(22.0.0)[Firestore]:侦听查询(target=Query(projects order by\uuuuuu name\uuuuuuuuuuu);limitType=LIMIT\u TO\u FIRST)失败:状态{code=PERMISSION\u DENIED,description=缺少或权限不足,原因=null}
══╡ 提供程序捕获到异常╞══════════════════════════════════════════════════════════════════
引发了以下断言:
所侦听的映射流引发了异常
StreamProvider,但未提供“catchError”。
例外情况:
[cloud_firestore/权限被拒绝]调用者没有执行指定任务的权限
活动
════════════════════════════════════════════════════════════════════════════════════════════════════
在测试环境中工作

在Android Studio(Flatter)中,我收到一个错误:

════════ Exception caught by provider ══════════════════════════════════════════════════════════════
The following assertion was thrown:
An exception was throw by _MapStream<QuerySnapshot, List<Project>> listened by

StreamProvider<List<Project>>, but no `catchError` was provided.

Exception:
[cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.

════════════════════════════════════════════════════════════════════════════════════════════════════
Reloaded 0 of 643 libraries in 649ms.
W/Firestore( 4590): (22.0.0) [Firestore]: Listen for Query(target=Query(projects order by __name__);limitType=LIMIT_TO_FIRST) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}

══╡ EXCEPTION CAUGHT BY PROVIDER ╞══════════════════════════════════════════════════════════════════
The following assertion was thrown:
An exception was throw by _MapStream<QuerySnapshot, List<Project>> listened by
StreamProvider<List<Project>>, but no `catchError` was provided.

Exception:
[cloud_firestore/permission-denied] The caller does not have permission to execute the specified
operation.

════════════════════════════════════════════════════════════════════════════════════════════════════
════════ 提供程序捕获到异常══════════════════════════════════════════════════════════════
引发了以下断言:
所侦听的映射流引发了异常
StreamProvider,但未提供“catchError”。
例外情况:
[cloud_firestore/权限被拒绝]调用方没有执行指定操作的权限。
════════════════════════════════════════════════════════════════════════════════════════════════════
在649毫秒内重新加载了643个库中的0个。
W/Firestore(4590):(22.0.0)[Firestore]:侦听查询(target=Query(projects order by\uuuuuu name\uuuuuuuuuuu);limitType=LIMIT\u TO\u FIRST)失败:状态{code=PERMISSION\u DENIED,description=缺少或权限不足,原因=null}
══╡ 提供程序捕获到异常╞══════════════════════════════════════════════════════════════════
引发了以下断言:
所侦听的映射流引发了异常
StreamProvider,但未提供“catchError”。
例外情况:
[cloud_firestore/权限被拒绝]调用者没有执行指定任务的权限
活动
════════════════════════════════════════════════════════════════════════════════════════════════════

注意。注意.request.resource.data.member不起作用:“错误:simulator.rules行[6],列[81]。对象上未定义属性资源。”再次检查此rulerequest.resource.data.member不起作用:“错误:simulator.rules行[6],列[81]。对象上未定义属性资源。”c