1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2024-11-29 02:12:14 +02:00

fixed auth collection rule check validator on create

This commit is contained in:
Gani Georgiev 2022-11-15 15:06:46 +02:00
parent f3566149b8
commit 4528f075dc
2 changed files with 7 additions and 5 deletions

View File

@ -280,6 +280,7 @@ func (form *CollectionUpsert) checkRule(value any) error {
}
dummy := *form.collection
dummy.Type = form.Type
dummy.Schema = form.Schema
dummy.System = form.System
dummy.Options = form.Options

View File

@ -185,16 +185,17 @@ func TestCollectionUpsertValidateAndSubmit(t *testing.T) {
"",
`{
"name": "test_new",
"type": "auth",
"system": true,
"schema": [
{"id":"a123456","name":"test1","type":"text"},
{"id":"b123456","name":"test2","type":"email"}
],
"listRule": "test1='123'",
"viewRule": "test1='123'",
"createRule": "test1='123'",
"updateRule": "test1='123'",
"deleteRule": "test1='123'"
"listRule": "test1='123' && verified = true",
"viewRule": "test1='123' && emailVisibility = true",
"createRule": "test1='123' && email != ''",
"updateRule": "test1='123' && username != ''",
"deleteRule": "test1='123' && id != ''"
}`,
[]string{},
},