-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Limit (filter) Relationship to a sub-set of List items #472
Comments
This could be possible when we expose the hooks: keystone.createList('Post', {
fields: {
reviewer: {
type: Relationship,
ref: 'User',
hooks: {
preUpdate: (data, item, context) => {
if (!data.isAdmin) throw new Error('Not allowed');
}
}
}
}
}); |
Yes that's one side of it. The other side is that in the Admin UI you are not presented with invalid options when creating the relationship. |
It looks like you haven't had a response in over 3 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contributions. :) |
The view section should now be done as a custom view. This use-case becomes rather simple if we land: #2885 |
In K4 it was possible to define a
filter
on a Relationship field type. This allowed restricting relationships created through the admin ui to a subset of a List.Related to: #376, #352
Example use cases
Post
has a relationship field for the assignedreviewer
. OnlyUser
's withisAdmin === true
can be assigned.In K4 this was defined on the List as follows:
Site
can havefeaturedTags
. ThoseTags
must be related to the currentsite
. ie:The text was updated successfully, but these errors were encountered: