v6 的 firebase rule 很重要
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// 保持原有的管理员权限检查函数
function isAdmin() {
return request.auth != null && request.auth.token.admin == true;
}
// 保持原有的规则
match /users/{userId} {
allow read, write: if true;
}
match /access_logs/{logId} {
allow read, create: if true;
allow update, delete: if false;
}
match /applications/{applicationId} {
allow read: if true;
allow write: if true;
}
match /admin_logs/{logId} {
allow read: if true;
allow write: if true;
}
// 只添加新的历史记录集合规则
match /application_history/{historyId} {
allow read: if true; // 保持与其他集合一致的访问权限
allow write: if true; // 保持与其他集合一致的访问权限
}
}
}