我正在开发一个Web应用程序,并且在测试我的Firebase安全规则时,我注意到您不知道“资源”一词的含义,我想确保只有能够看到医院患者的人才应该这样做。成为医院内实际工作的医生
function iamOfThisHospital(){
return get(/databases/$(database)/documents/users/$(request.auth.uid)).data.universalIndetifier.hospital
== request.resource.data.universalIndetifier.hospital
}
答案 0 :(得分:0)
在Cloud Firestore安全规则中,import browser from 'webextension-polyfill'
function insertCSS(file) {
const style = document.createElement('link')
style.rel = 'stylesheet'
style.type = 'text/css'
style.href = browser.extension.getURL('style.css')
style.id = file
document.getElementsByTagName('html')[0].appendChild(style)
}
function removeCSS(file) {
const cssNode = document.getElementById(file)
cssNode && cssNode.parentNode.removeChild(cssNode)
}
browser.runtime.onMessage.addListener(message => {
const id = 'redact-the-web'
if (message.command === 'insertCSS') {
insertCSS(id)
} else if (message.command === 'removeCSS') {
removeCSS(id)
}
})
指数据库中的现有文档,而{
"manifest_version": 2,
"name": "Redact The Web",
"offline_enabled": true,
"version": "1.0.0",
"description": "Extension that redacts text on the web",
"icons": {
"16": "icon16.png",
"19": "icon19.png",
"24": "icon24.png",
"32": "icon32.png",
"38": "icon38.png",
"48": "icon48.png",
"64": "icon64.png",
"128": "icon128.png"
},
"background": {
"scripts": ["background.js"]
},
"browser_action": {},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["content.js"],
"run_at": "document_start"
}
],
"web_accessible_resources": ["style.css"],
"permissions": ["https://*/*", "http://*/*"]
}
指请求中存在的文档(在写操作期间,即{{1} }或resource
)。
您可能想要进行阅读(因为每次阅读没有request.resource
)是将用户的医院与set
(而不是update
)进行比较:
request.resource