Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field validation builder: relations can't be selected directly #12040

Closed
3 tasks done
Dominic-Marcelino opened this issue Mar 8, 2022 · 0 comments · Fixed by #12320
Closed
3 tasks done

Field validation builder: relations can't be selected directly #12040

Dominic-Marcelino opened this issue Mar 8, 2022 · 0 comments · Fixed by #12320
Labels

Comments

@Dominic-Marcelino
Copy link
Contributor

Dominic-Marcelino commented Mar 8, 2022

Preflight Checklist

Describe the Bug

In order to create some validations and presets we need to compare the value for relational fields.
The builder only allows to select the sub-fields from the relation, but not the field itself.

Example below.

To Reproduce

  1. Create two user-roles "role A" and "role B"
  2. Open directus_user >> create option for role_A
  3. Try to limit the user_creation to users with role_A or role_B
  4. The permissions-builder will not let you select the "role" field, but role_id
  5. If you select role_id field and enter the ID user of role_a won't be able to create any users (validation fails, needs to be type of object.

Instead we can add the validation manually to the role value and it work's as expected

{
	"_and": [
		{
			"_or": [
				{
					"role": {
						"_eq": "8556537d-450f-4303-92e1-e0a9936f73fc"
					}
				},
			[.......]
	]
}

Errors Shown

No response

What version of Directus are you using?

9.6.0

What version of Node.js are you using?

16.14

What database are you using?

mySql 8

What browser are you using?

Chrome

What operating system are you using?

Mac

How are you deploying Directus?

locally

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants