-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Fix creator fields in REST API #13819
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #13819 +/- ##
==========================================
+ Coverage 54.36% 54.40% +0.04%
==========================================
Files 1190 1190
Lines 30184 30199 +15
Branches 5476 5471 -5
==========================================
+ Hits 16409 16430 +21
+ Misses 11999 11995 -4
+ Partials 1776 1774 -2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
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 work!
Some questions 👀
packages/core/utils/lib/sanitize/visitors/remove-restricted-relations.js
Outdated
Show resolved
Hide resolved
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.
Just a quick question 👀
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.
LGTM, waiting for the tests to pass
|
This pull request has been mentioned on Strapi Community Forum. There might be relevant details there: |
|
Hello, I tried this on Strapi v4.15.5 but didn't work (I added |
What does it do?
removeRestrictedRelationsnow uses the value ofpopulateCreatorFieldsto determine ifcreatedByandupdatedByshould be removed, rather than checking the'admin::user'permission for those creator fields.Why is it needed?
Creator fields were available in v3, but in v4
createdByandupdatedByfields are no longer available in the API whenpopulateCreatorFieldsis true, because they are being removed when the user does not have'admin::user'permissions (which cannot be granted in the admin)How to test it?
options.populateCreatorFieldstotrueUnit tests for this functionality are included
Related issue(s)/PR(s)
#12228
There's a separate issue with the GraphQL schema for creator fields that needs to be fixed before it will be available in GraphQL