1
How can I define a safety rule that:
- Allow read and write access to recipes if the logged in user is the user who registered it
- Allow read access to recipes if the
tipo
fortrue
- Do not allow read and write access to recipes if the logged in user is not the user who registered it
- Allow read and write access to users if the username and password sent are the same registered (login), I imagine something with
newData
- How to allow reading of the user name, not to allow two users with the same name, in the most secure way possible
Data structure:
{
"receitas" : {
"-L7bAaMB-vaJhri6r-lg" : {
"imagem" : "default",
"ingrediente" : [ "teste" ],
"nome" : "teste",
"preparo" : "teste",
"tipo" : false,
"usuario": "-L7WxcAHr8LkfJAiI8ku"
},
"-L7bAqvMu8uOoY6nX5Tx" : {
"imagem" : "example.png",
"ingrediente" : [ "teste2" ],
"nome" : "teste2",
"preparo" : "teste2",
"tipo" : true,
"usuario": "-L7WxcAHr8LkfJAiI8ku"
}
},
"usuarios" : {
"-L7WxcAHr8LkfJAiI8ku" : {
"senha" : "123456789",
"usuario" : "guilherme"
},
"-L7bAk3EcsoOQapV9zsb" : {
"senha" : "123456789",
"usuario" : "patricia"
}
}
}
Show the rules you currently have.
– Rosário Pereira Fernandes
@Rosáriopereirafernandes currently my rules are public (
read
andwrite
aretrue
)– Costamilam
Points 1 and 3 say the same thing ..
– Rosário Pereira Fernandes
@Rosáriopereirafernandes I know that, but to keep it very clear...
– Costamilam
At point 4, do you talk about reading and writing at which node? Recipes or users?
– Rosário Pereira Fernandes
user, refers to login
– Costamilam
Point 4 is not yet clear. You can give examples of what is allowed and what is not?
– Rosário Pereira Fernandes
Point 4 is just a way for two users to register the same data and connect to each other’s account, so you can’t have two equal user names
– Costamilam