GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — master-git-github/firebase.rules at main · aidrivencoder/master-git-github

Expand file tree

/

firebase.rules

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
66 lines (58 loc) · 2.01 KB
/

firebase.rules

Copy path

File metadata and controls

66 lines (58 loc) · 2.01 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
// Helper functions
function isAuthenticated() {
return request.auth != null;
}
function isAdmin() {
return isAuthenticated() &&
get(/databases/$(database)/documents/users/$(request.auth.uid)).data.role == 'admin';
}
function isOwner(userId) {
return isAuthenticated() && request.auth.uid == userId;
}
function hasActivePremium(userId) {
return get(/databases/$(database)/documents/users/$(userId)).data.subscription.tier == 'premium' &&
get(/databases/$(database)/documents/users/$(userId)).data.subscription.validUntil > request.time;
}
// Users collection
match /users/{userId} {
allow read: if isAuthenticated() && (isOwner(userId) || isAdmin());
allow create: if isAuthenticated() && isOwner(userId);
allow update: if isAuthenticated() && (isOwner(userId) || isAdmin());
allow delete: if isAdmin();
}
// Tutorials collection
match /tutorials/{tutorialId} {
allow read: if
!resource.data.isPremium ||
(isAuthenticated() && hasActivePremium(request.auth.uid));
allow write: if isAdmin();
}
// Progress collection
match /progress/{progressId} {
allow read: if isAuthenticated() && (
resource.data.userId == request.auth.uid || isAdmin()
);
allow create, update: if isAuthenticated() && (
request.resource.data.userId == request.auth.uid
);
allow delete: if isAdmin();
}
// Subscriptions collection
match /subscriptions/{subscriptionId} {
allow read: if isAuthenticated() && (
resource.data.userId == request.auth.uid || isAdmin()
);
allow write: if isAdmin();
}
// Checkout Sessions collection
match /checkoutSessions/{sessionId} {
allow read: if isAuthenticated() && (
resource.data.userId == request.auth.uid || isAdmin()
);
allow write: if isAdmin();
}
}
}
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.