@openinc/parse-server-opendash 4.3.1 → 4.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -172,13 +172,23 @@ async function assignTicketNumber(ticket) {
|
|
|
172
172
|
return; // no scope to count within — leave unnumbered
|
|
173
173
|
ticket.set("number", await nextTenantTicketNumber(tenant));
|
|
174
174
|
}
|
|
175
|
-
/**
|
|
175
|
+
/**
|
|
176
|
+
* Find-or-create the tenant's ticket counter and return the next value.
|
|
177
|
+
*
|
|
178
|
+
* Counters are server-internal — only this hook and the migration ever touch
|
|
179
|
+
* them — so every row gets an empty ACL: nobody but the master/maintenance key
|
|
180
|
+
* reads or writes it. The class CLP says the same (`Service_TicketCounter.json`);
|
|
181
|
+
* this is the per-row half of it, and it also repairs rows written before either
|
|
182
|
+
* existed, which carried the Parse default of public read *and write*. A client
|
|
183
|
+
* that could set `value` could hand another tenant duplicate ticket numbers.
|
|
184
|
+
*/
|
|
176
185
|
async function nextTenantTicketNumber(tenant) {
|
|
177
186
|
const existing = await new node_1.default.Query("OD3_Service_TicketCounter")
|
|
178
187
|
.equalTo("tenant", tenant)
|
|
179
188
|
.first({ useMasterKey: true });
|
|
180
189
|
if (existing) {
|
|
181
190
|
existing.increment("value", 1);
|
|
191
|
+
existing.setACL(new node_1.default.ACL());
|
|
182
192
|
await existing.save(null, { useMasterKey: true });
|
|
183
193
|
return existing.get("value");
|
|
184
194
|
}
|
|
@@ -186,6 +196,7 @@ async function nextTenantTicketNumber(tenant) {
|
|
|
186
196
|
const counter = new Counter();
|
|
187
197
|
counter.set("tenant", tenant);
|
|
188
198
|
counter.set("value", 1);
|
|
199
|
+
counter.setACL(new node_1.default.ACL());
|
|
189
200
|
await counter.save(null, { useMasterKey: true });
|
|
190
201
|
return 1;
|
|
191
202
|
}
|
|
@@ -115,6 +115,9 @@ class TicketNumberer {
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
counter.set("value", value);
|
|
118
|
+
// Same closed ACL the hook writes: counters are server-internal, so no
|
|
119
|
+
// client — of this tenant or any other — may read or increment one.
|
|
120
|
+
counter.setACL(new node_1.default.ACL());
|
|
118
121
|
await counter.save(null, acl_js_1.MIGRATION_SAVE);
|
|
119
122
|
if (!existingId && counter.id)
|
|
120
123
|
this.tenantCounterIds.set(tenantId, counter.id);
|
package/package.json
CHANGED
|
@@ -12,27 +12,15 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"classLevelPermissions": {
|
|
15
|
-
"find": {
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
"*": true
|
|
26
|
-
},
|
|
27
|
-
"update": {
|
|
28
|
-
"*": true
|
|
29
|
-
},
|
|
30
|
-
"delete": {
|
|
31
|
-
"*": true
|
|
32
|
-
},
|
|
33
|
-
"addField": {
|
|
34
|
-
"*": true
|
|
35
|
-
},
|
|
36
|
-
"protectedFields": {}
|
|
15
|
+
"find": {},
|
|
16
|
+
"count": {},
|
|
17
|
+
"get": {},
|
|
18
|
+
"create": {},
|
|
19
|
+
"update": {},
|
|
20
|
+
"delete": {},
|
|
21
|
+
"addField": {},
|
|
22
|
+
"protectedFields": {
|
|
23
|
+
"*": []
|
|
24
|
+
}
|
|
37
25
|
}
|
|
38
26
|
}
|