[#1030] fixed auth collection rules validator
This commit is contained in:
		
							parent
							
								
									9322b13d15
								
							
						
					
					
						commit
						f3566149b8
					
				|  | @ -279,8 +279,12 @@ func (form *CollectionUpsert) checkRule(value any) error { | |||
| 		return nil // nothing to check
 | ||||
| 	} | ||||
| 
 | ||||
| 	dummy := &models.Collection{Schema: form.Schema} | ||||
| 	r := resolvers.NewRecordFieldResolver(form.dao, dummy, nil, true) | ||||
| 	dummy := *form.collection | ||||
| 	dummy.Schema = form.Schema | ||||
| 	dummy.System = form.System | ||||
| 	dummy.Options = form.Options | ||||
| 
 | ||||
| 	r := resolvers.NewRecordFieldResolver(form.dao, &dummy, nil, true) | ||||
| 
 | ||||
| 	_, err := search.FilterData(*v).BuildExpr(r) | ||||
| 	if err != nil { | ||||
|  |  | |||
|  | @ -279,11 +279,11 @@ func TestCollectionUpsertValidateAndSubmit(t *testing.T) { | |||
| 				"schema": [ | ||||
| 					{"id":"_2hlxbmp","name":"test","type":"text"} | ||||
| 				], | ||||
| 				"listRule": "test='123'", | ||||
| 				"viewRule": "test='123'", | ||||
| 				"createRule": "test='123'", | ||||
| 				"updateRule": "test='123'", | ||||
| 				"deleteRule": "test='123'", | ||||
| 				"listRule": "test='123' && verified = true", | ||||
| 				"viewRule": "test='123' && emailVisibility = true", | ||||
| 				"createRule": "test='123' && email != ''", | ||||
| 				"updateRule": "test='123' && username != ''", | ||||
| 				"deleteRule": "test='123' && id != ''", | ||||
| 				"options": {"minPasswordLength": 10} | ||||
| 			}`, | ||||
| 			[]string{}, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue