f1e0f6b5ef
- Add complete server infrastructure with Gitea, API, PostgreSQL - Implement Obsidian-compatible markdown mindmap converter - Add Flutter service for server synchronization - Configure GitHub Actions for automated build and deploy - Add production docker-compose with health checks - Include VPS setup and deployment scripts - Add comprehensive deployment documentation
103 lines
3.1 KiB
Plaintext
103 lines
3.1 KiB
Plaintext
rules_version = '2';
|
||
|
||
service cloud.firestore {
|
||
match /databases/{database}/documents {
|
||
|
||
// Helper functions
|
||
function isAuthenticated() {
|
||
return request.auth != null;
|
||
}
|
||
|
||
function isOwner(userId) {
|
||
return request.auth.uid == userId;
|
||
}
|
||
|
||
function isTeamMember(teamId) {
|
||
let team = get(/databases/$(database)/documents/teams/$(teamId)).data;
|
||
return team.memberIds.hasAny([request.auth.uid]);
|
||
}
|
||
|
||
// Users - пользователи могут читать и обновлять свой профиль
|
||
match /users/{userId} {
|
||
allow read: if isAuthenticated();
|
||
allow create: if isOwner(userId);
|
||
allow update, delete: if isOwner(userId);
|
||
}
|
||
|
||
// Teams - команды
|
||
match /teams/{teamId} {
|
||
allow read: if isAuthenticated();
|
||
allow create: if isAuthenticated();
|
||
allow update: if isAuthenticated() && isTeamMember(teamId);
|
||
allow delete: if isAuthenticated() && isTeamMember(teamId);
|
||
|
||
// Подколлекции команд
|
||
match /projects/{projectId} {
|
||
allow read: if isAuthenticated();
|
||
allow create: if isAuthenticated();
|
||
allow update, delete: if isAuthenticated();
|
||
}
|
||
}
|
||
|
||
// Projects - проекты
|
||
match /projects/{projectId} {
|
||
allow read: if isAuthenticated();
|
||
allow create: if isAuthenticated();
|
||
allow update, delete: if isAuthenticated();
|
||
}
|
||
|
||
// Tasks - задачи
|
||
match /tasks/{taskId} {
|
||
allow read: if isAuthenticated();
|
||
allow create: if isAuthenticated();
|
||
allow update: if isAuthenticated();
|
||
allow delete: if isAuthenticated();
|
||
}
|
||
|
||
// Mind Maps - карты проектов (старая структура)
|
||
match /mindmaps/{projectId} {
|
||
allow read: if isAuthenticated();
|
||
allow create: if isAuthenticated();
|
||
allow update: if isAuthenticated();
|
||
allow delete: if isAuthenticated();
|
||
|
||
match /nodes/{nodeId} {
|
||
allow read: if isAuthenticated();
|
||
allow create: if isAuthenticated();
|
||
allow update: if isAuthenticated();
|
||
allow delete: if isAuthenticated();
|
||
}
|
||
}
|
||
|
||
// Mind Maps - новая структура с ownerEmail и isMain
|
||
match /mind_maps/{mindMapId} {
|
||
allow read: if isAuthenticated();
|
||
allow create: if isAuthenticated();
|
||
allow update: if isAuthenticated();
|
||
allow delete: if isAuthenticated();
|
||
}
|
||
|
||
// Events - события календаря
|
||
match /events/{eventId} {
|
||
allow read: if isAuthenticated();
|
||
allow create: if isAuthenticated();
|
||
allow update: if isAuthenticated();
|
||
allow delete: if isAuthenticated();
|
||
}
|
||
|
||
// Alarms - будильники
|
||
match /alarms/{alarmId} {
|
||
allow read: if isAuthenticated();
|
||
allow create: if isAuthenticated();
|
||
allow update: if isAuthenticated();
|
||
allow delete: if isAuthenticated();
|
||
}
|
||
|
||
// Settings - настройки
|
||
match /settings/{settingId} {
|
||
allow read: if isAuthenticated();
|
||
allow write: if isAuthenticated();
|
||
}
|
||
}
|
||
}
|