-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathstore.fga.yaml
260 lines (222 loc) · 6.4 KB
/
store.fga.yaml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# inspired in https://www.notion.so/pricing
model: |
model
schema 1.1
type user
type organization
relations
define member: [user]
type plan
relations
define subscriber: [organization#member]
type feature
relations
define has_feature: [plan#subscriber, plan#subscriber with is_below_collaborator_limit, plan#subscriber with is_below_row_sync_limit, plan#subscriber with is_below_page_history_days_limit]
condition is_below_collaborator_limit(collaborator_count: int, collaborator_limit: int) {
collaborator_count <= collaborator_limit
}
condition is_below_row_sync_limit(row_sync_count: int, row_sync_limit: int) {
row_sync_count <= row_sync_limit
}
condition is_below_page_history_days_limit(page_history_days_count: int, page_history_days_limit: int) {
page_history_days_count <= page_history_days_limit
}
tuples:
- user: user:anne
relation: member
object: organization:acme
- user: user:beth
relation: member
object: organization:okta
- user: organization:acme#member
relation: subscriber
object: plan:free
- user: organization:okta#member
relation: subscriber
object: plan:pro
# Free Package definition
# priority_support: false
# page_analytics: basic
# page_history_days: 7
# guest_collaborators: 10
# row_limit_per_synced_db: 100
- user: plan:free#subscriber
relation: has_feature
object: feature:can-view-page-history
condition:
name: is_below_page_history_days_limit
context:
page_history_days_limit: 7
- user: plan:free#subscriber
relation: has_feature
object: feature:can-invite-collaborator
condition:
name: is_below_collaborator_limit
context:
collaborator_limit: 10
- user: plan:free#subscriber
relation: has_feature
object: feature:can-sync-rows
condition:
name: is_below_row_sync_limit
context:
row_sync_limit: 100
- user: plan:free#subscriber
relation: has_feature
object: feature:basic-page-analytics
# Pro Package definition
# priority_support: true
# page_analytics: advanced
# page_history_days: 30
# guest_collaborators: 100
# row_limit_per_synced_db: 20000
- user: plan:pro#subscriber
relation: has_feature
object: feature:can-view-page-history
condition:
name: is_below_page_history_days_limit
context:
page_history_days_limit: 30
- user: plan:pro#subscriber
relation: has_feature
object: feature:can-invite-collaborator
condition:
name: is_below_collaborator_limit
context:
collaborator_limit: 100
- user: plan:pro#subscriber
relation: has_feature
object: feature:can-sync-rows
condition:
name: is_below_row_sync_limit
context:
row_sync_limit: 20000
- user: plan:pro#subscriber
relation: has_feature
object: feature:advanced-page-analytics
- user: plan:pro#subscriber
relation: has_feature
object: feature:enterprise-support
tests:
- name: Tests for Pro subscriber
check:
- user: user:beth
object: feature:can-view-page-history
context:
page_history_days_count: 10
assertions:
has_feature: true
- user: user:beth
object: feature:can-invite-collaborator
context:
collaborator_count: 20
assertions:
has_feature: true
- user: user:beth
object: feature:can-sync-rows
context:
row_sync_count: 200
assertions:
has_feature: true
- user: user:beth
object: feature:advanced-page-analytics
assertions:
has_feature: true
- user: user:beth
object: feature:enterprise-support
assertions:
has_feature: true
- user: user:beth
object: plan:pro
assertions:
subscriber: true
list_objects:
- user: user:beth
type : feature
context:
collaborator_count: 1
row_sync_count : 1
page_history_days_count : 1
assertions:
has_feature:
- feature:can-invite-collaborator
- feature:can-sync-rows
- feature:can-view-page-history
- feature:advanced-page-analytics
- feature:enterprise-support
- name: Tests for Free subscriber
check:
- user: user:anne
object: feature:can-view-page-history
context:
page_history_days_count: 10
assertions:
has_feature: false
- user: user:anne
object: feature:can-invite-collaborator
context:
collaborator_count: 20
assertions:
has_feature: false
- user: user:anne
object: feature:can-sync-rows
context:
row_sync_count: 200
assertions:
has_feature: false
- user: user:anne
object: feature:advanced-page-analytics
assertions:
has_feature: false
- user: user:anne
object: feature:enterprise-support
assertions:
has_feature: false
- user: user:anne
object: plan:pro
assertions:
subscriber: false
- user: user:anne
object: feature:can-view-page-history
context:
page_history_days_count: 1
assertions:
has_feature: true
- user: user:anne
object: feature:can-invite-collaborator
context:
collaborator_count: 1
assertions:
has_feature: true
- user: user:anne
object: feature:can-sync-rows
context:
row_sync_count: 1
assertions:
has_feature: true
- user: user:anne
object: feature:basic-page-analytics
assertions:
has_feature: true
list_objects:
- user: user:anne
type : feature
context:
collaborator_count: 1
row_sync_count : 1
page_history_days_count : 1
assertions:
has_feature:
- feature:can-invite-collaborator
- feature:can-sync-rows
- feature:can-view-page-history
- feature:basic-page-analytics
- user: user:anne
type : feature
context:
collaborator_count: 1000
row_sync_count : 1000
page_history_days_count : 1000
assertions:
has_feature:
- feature:basic-page-analytics