-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Filter inactive items also for admins. #4099
base: master
Are you sure you want to change the base?
Conversation
@gyst thanks for creating this Pull Request and helping to improve Plone! TL;DR: Finish pushing changes, pass all other checks, then paste a comment:
To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically. Happy hacking! |
Hang on, I think I can fix the issue while keeping the current default behavior. |
b599482
to
0858e05
Compare
I improved this PR to retain the current default behavior, while still fixing the bug. |
show_inactive = kw.get("show_inactive", False) | ||
if isinstance(query, dict) and not show_inactive: | ||
show_inactive = "show_inactive" in query | ||
show_inactive = kw.get("show_inactive", None) |
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.
I know I could've just used kw.get("show_inactive")
here and below, but since this logic depends so crucially on None
being different from False
, I preferred the explicit variant.
Seems fine to me, show inactive = False is ok. If it is True, that means "let me show inactive" even if the user should not? show_inactive is used here:
" # Include inactive content in result list. This is # especially important for content scheduled to go public # in the future, but needs to be reviewed before this." and here:
respect effective/expiration dateand some other places: https://github.com/search?q=org%3Aplone+show_inactive&type=code |
Yes, that's unchanged from the current implementation. Also the default behavior remains unchanged for both admins and non-admins. The only change is, that if you're an admin, it was previously hardcoded that you would always see inactive items; and this is still the default; however if you as an admin request Since |
FWIW, in a recent Plone 6 project, we have a lot of users who can add content, but are not Managers. They have "can add" permissions wherever they need it. We had the case where those users set some content to be published in the future, but they can't see those contents. We went to the We thought that this was a regression in Plone 6, because this site was migrated from Plone 4 and those users had no problems in the previous versions. So we went Plone 4 and found that there we had also the same permission set for "Authenticated" users. |
This will still be required, this PR does not change that. What it does change, that if you have that permission and you then query |
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.
Looks okay to me, and thanks for adding tests. Let's run the tests for all Plone packages and make sure there are no regressions:
@jenkins-plone-org please run jobs
Fixes #4098.
This keeps the existing default behavior, while allowing suppressing inactive content for admins, if
show_inactive=False
is explicitly passed as a keyword or query.