我在Permission denied
setValue()
后收到firebaseRef
错误
我的规则看起来像这样:
{
"rules": {
".read" : "auth.provider == 'google'",
".write" : "auth.provider == 'google'",
"hashTags": {
"$userEncodedEmail": {
"$hashTag": {
".validate": "newData.hasChildren(['createByUserEmail', 'name','timeStampLastUsed','tasksKeys'])",
"createByUserEmail": {
".validate": "newData.isString() && newData.val().matches(/^[A-Z0-9,_%+-]+@[A-Z0-9,-]+,[A-Z]{2,4}$/i)"
},
"name": {
".validate": "newData.isString() && newData.val().length <= 500"
},
"timeStampLastUsed": {
".validate": "newData.hasChildren(['timestamp'])",
"timestamp": {
".validate": "newData.isNumber()"
},
"$other": {
".validate": "false"
}
},
"tasksKeys": {
},
"$other": {
".validate": "false"
}
}
}
}
}
Java模型是:
public class HashTagModel {
private HashMap<String, Object> timeStampLastUsed;
@Expose
private String name;
@Expose
private String createByUserEmail;
private List<String> tasksKeys;
...
}
我也尝试过:
{
"rules": {
".read" : "auth.provider == 'google'",
".write" : "auth.provider == 'google'",
"hashTags": {
"$userEncodedEmail": {
"$hashTag": {
...
"tasksKeys": {
"$taskId": {
".validate": "newData.isString()"
}
},
...
}
}
}
}