我的请求在外观上非常简单:使用 Firestore 规则限制子集合中的文档数量。
我已经知道可以使用.size(). 所以,你可能会问为什么我不使用数组来存储我的项目?好吧,我希望“普通”用户无法更新我的父文档字段,但能够将文档添加到我的子集合中。
我已经尝试过这样做:
match /slots/{slot} {
allow read: if true;
allow write: if getRole() == 'ADMIN';
match /participants/{participant} {
allow read: if true;
allow create: if get(/databases/$(database)/documents/slots/$(slot)/participants).size() < 2;
allow delete: if participant.data.id == request.auth.uid || getRole() == 'ADMIN';
}
}
Run Code Online (Sandbox Code Playgroud)
但get(/databases/$(database)/documents/slots/$(slot)/participants)不能正常工作,因为get()只应用于获取单个文档。
也许我可以尝试使用云功能的东西...
我的问题有什么解决办法吗?感谢您的帮助 !
我需要跟踪某人何时从我的服务器下载文件,因此我创建了一个将文件名作为参数的端点。
此端点仅发送 GA 事件并将文件返回给用户。
但是,由于我是服务器端,我无法轻松获取客户端 ID 将其发送回 Google Analytics。经过一些研究,此 CID 在_gacookie 中可用,但 Google 建议不要指望它,因为 cookie 将来可能会发生变化:
那么,我如何收集客户端 ID 服务器端以将其与我的事件一起发回?
I have got a problem with the footerTemplate parameter of Puppeteer : the footer is only shown in the last page of the document. I want it to be displayed on every page of the document (well... a footer).
Maybe am I not using the parameters correctly ?
Here is my Puppeteer pdf generation :
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('http://localhost:8000/?' + parameters);
await page.pdf({
path: path,
format: 'A4',
displayHeaderFooter: true,
footerTemplate: '<h1>THIS IS …Run Code Online (Sandbox Code Playgroud)