Skip to content

Commit

Permalink
fixed auth collection rule check validator on create
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Nov 15, 2022
1 parent f356614 commit 4528f07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions forms/collection_upsert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions forms/collection_upsert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
},
Expand Down

0 comments on commit 4528f07

Please sign in to comment.