-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[5.3] Fix item count does not take access level into account #44950
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
base: 5.3-dev
Are you sure you want to change the base?
Conversation
f9af518
to
dd5e3b4
Compare
@janschoenherr I think the test instructions belong to the new Articles-module? If so i didn't find where the "Article Count" to set. If not, can you please be more specific in the test instructions? |
I updated the testing instructions. |
I have tested this item ✅ successfully on dd5e3b4 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950. |
1 similar comment
I have tested this item ✅ successfully on dd5e3b4 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950. |
I have tested this item 🔴 unsuccessfully on dd5e3b4 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950. |
There are probably other areas negatively impacted by this change - this was just the first one that came to mind |
dd5e3b4
to
02e35d0
Compare
I have added a new option |
02e35d0
to
5085b03
Compare
This actually fixes another bug. Just evaluating the menu params, doesn't take the global component parameters into account. e.g. |
@janschoenherr Can you update the test instructions including the #44950 (comment) by @brianteeman and your comment?
|
I have tested this item ✅ successfully on 5085b03 Unauthorised Links
|
I have tested this item ✅ successfully on 24db2a0 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950. |
I have tested this item ✅ successfully on 24db2a0 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950. |
$options['access'] = $options['access'] ?? 'true'; | ||
$options['published'] = $options['published'] ?? 1; | ||
$options['countItems'] = $options['countItems'] ?? 0; | ||
$options['accessOnItems'] = $options['accessOnItems'] ?? true; |
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 haven't checked the details but there are potential issues here. You enable accessOnItems
by default, so it will:
- Change the previous behavior
- If the items table does not have access field, it will cause SQL error.
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 enabled it by default, because 'access' is enabled by default too and otherwise we'd have to change all places, where this is called (That's possible too, of course). I believe all relevant Joomla tables have an access field. But yes, if you have a 3rd party extension without the access field on the item table, it might break.
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.
Better be safe. We could not know what people do with their own code.
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.
Okay, I updated the PR to default enable it for core extensions only.
@janschoenherr - now when I try to test, we have a regression possibly, the results are the same with and without the PR - unlike in my previous test where things were different and matching the aim of the PR (filtering out the item count).... FYI. |
@janschoenherr yes, I am using a menu item of type List All Categories in an Article Category Tree... I just retested it, 1 minute ago and still same reaction - the numbers do not move, if need be, I can make a video... |
@exlemor Thanks for testing. Did you set the 'Unauthorised Links' option in Articles to |
With Unauthorized Links set to No or Yes, same results with none of the numbers changing ;( |
And you are not logged-in in the frontend, right? |
Definitely only logged into the backend. Not the front-end. |
@janschoenherr - Could the issue be that I set those articles to Special and Super Users vs Registered or Publisher etc? Just changed one of the articles from Special to Registered and it didn't work either ;( - sorry. |
I have tested this item ✅ successfully on 0ed6a90 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950. |
Here's a before-and-after look at the results of this PR! PR.-.44950.2.1.mp4 |
@exlemor I rebased the PR to 5.3 now. Thanks for looking into it! |
Please fix phpcs: https://ci.joomla.org/joomla/joomla-cms/83956/1/7 |
I have tested this item ✅ successfully on cc910c8 @janschoenherr (sorry it took me so long to re-test this). This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950. |
Thanks for testing again! |
I have tested this item ✅ successfully on 5aabb98 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/44950. |
Currently when getting the item count of a category, the access level is not being taken into account. This PR fixes the issue.
Summary of Changes
Add the access condition to the item subquery.
Testing Instructions
Create a menu item of type
List All Categories in an Article Category Tree
.If you navigate to the menu item, it should display a list of categories with an article count.
Have at least one article in one of the categories restricted by its access level. Make sure you are not logged in.
Actual result BEFORE applying this Pull Request
The access restricted article is being included in the article count.
The
Articles
>Unauthorized Links
option has no effect on the article count.Expected result AFTER applying this Pull Request
The access restricted article is not being included in the item count.
If however
Articles
>Unauthorized Links
option is set toYes
the access restricted article is included.Link to documentations
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed