-
-
Notifications
You must be signed in to change notification settings - Fork 966
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
Only return published blog entries. #1757
base: main
Are you sure you want to change the base?
Conversation
On a side note, my test suite is failing me and I'm not sure why.
Discovered the reason for this; #1758 |
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.
Thanks for the quick response on this, nice work 👍🏻
If you allow me to change/extend the scope of this PR a little bit, I think it's not enough to test for user.is_staff
but we should also make sure that the user has write permissions on the BlogEntry
model (since this feature is meant to be used for previewing).
And there should also be some tests added (I'm suprised there weren't already, or that if there were they were still passing after this change):
- anon users can't see unpublished entries at all (list or detail)
- logged in users (non-staff) can't see unpublished entries at all
- staff users without write permission on
BlogEntry
can't see unpublished entries at all - staff users with write permission on
BlogEntry
can't see unpublished entries in the list, but can view the detail page
@marksweb this is great. Thank you for jumping in on this. |
Yes I was surprised & expecting you to suggest this 😄 |
This fixes #1755 to only return published blog entries, even for staff users.
Unpublished entries can still be previewed via the admin.