Firebase DB规则条件基于resource.data

时间:2018-07-09 16:08:53

标签: firebase google-cloud-firestore firebase-security-rules

我创建了以下规则:

render() {
    return (
        <div>
            <h1>Form</h1>
            <form onSubmit = { this.onSubmit } action="/form" method="post">
                <div>
                    <input type="text" value={this.state.first} name="first" autoFocus="autoFocus" onChange={ this.handleInputChange } />
                    <input type="text" value={this.state.second} name="second" onChange={ this.handleInputChange } />
                </div>

                <button onClick={this.handleDouble}>Double</button>
                <button>Submit</button>
            </form>
        </div>
    );
}

handleDouble(e) {
    e.preventDefault();
}

这是我的文档(match /chats/{chat} { allow read,write: if request.auth.uid == resource.data.user1.uid || request.auth.uid == resource.data.user2.uid } )的样子:

enter image description here

用户uid之一是我的firbase UID,但是当我使用模拟器检查用户是否通过此验证时(我只是将firebaes UID放在模拟器中),该行未标记为“允许访问”

知道我在这里缺少什么吗?

0 个答案:

没有答案