-
Notifications
You must be signed in to change notification settings - Fork 117
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
fix: use available CTs instead of only readable #1562
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix. If you have time for this, I would appreciate a small comment next to the code, so we don't break this later again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to block but just want to make sure I understand this. it seems readableContentTypes
are only ever used in the places you changed in this PR, so does that mean we should remove them from the reference editor props?
Also, any reason why not to fix this on the app level?
f840981
to
05b4597
Compare
Good point @z0al, I didn't notice they are not used anymore, we could remove them in this case.
Do you mean the web app here? This logic is all encapsulated inside the field-editor itself, it essentially determines the CTs to show based on field validations and permissions, they cannot be overridden from the outside atm and introducing new parameters seemed that it would complicate the logic even more. Do you have another suggestion? |
You're right @SofiaMargariti , I was under the impression that the list is passed down from the host app but I was wrong. In that case, let's remove please the |
The way reference field works, it will take the available CTs for the field - via validations - filter out the ones that user has no permissions to read and pass the remaining list to the Entity Search modal. If an empty array of CTs is provided Entity Search will render all CTs of the environment.
When a user has partial access to content types e.g. via tags these content types will not appear in the list of readable CTs and will result in an empty array to be passed to Entity Search which will then result in all available CTs to be listed overriding the field validations.
If instead we pass the available CTs then Entity Search will still respect the validations and is smart enough to filter out individual entities the user might not have permissions to read.
See the following example:
Component:Text
entries to be linked via validationsComponent:Text
via tags but cannot read any entry of that CTBefore all CTs would be listed:
After, only the
Component:Text
is listed and only the entries that user can read:Related tickets: