No Code Attached Yet
avatar NicolasDerumigny
NicolasDerumigny
16 Oct 2024

Steps to reproduce the issue

Create an Article - newsflash module and an article whose published date is after the current date.

Expected result

The article is displayed in the module.

Actual result

The article is not displayed on the module.

System information (as much as possible)

Joomla 5.2 on a raspberry pi 3B running up to date debian.

Additional comments

This is due to42694 that breaks the former behaviour (which I uses).

The following patch brings it back without touching #42694's spirit:

diff --git a/modules/mod_articles_news/src/Helper/ArticlesNewsHelper.php b/modules/mod_articles_news/src/Helper/ArticlesNewsHelper.php
index 067dc9b44..58826839c 100644
--- a/modules/mod_articles_news/src/Helper/ArticlesNewsHelper.php
+++ b/modules/mod_articles_news/src/Helper/ArticlesNewsHelper.php
@@ -56,7 +56,7 @@ class ArticlesNewsHelper implements DatabaseAwareInterface
         $model->setState('params', $appParams);

         $model->setState('list.start', 0);
-        $model->setState('filter.published', 1);
+        $model->setState('filter.published', array(0, 1));

         // Set the filters based on the module params
         $model->setState('list.limit', (int) $params->get('count', 5));
avatar NicolasDerumigny NicolasDerumigny - open - 16 Oct 2024
avatar joomla-cms-bot joomla-cms-bot - change - 16 Oct 2024
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 16 Oct 2024
avatar Hackwar Hackwar - change - 16 Oct 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-10-16 15:45:49
Closed_By Hackwar
avatar Hackwar Hackwar - close - 16 Oct 2024
avatar Hackwar
Hackwar - comment - 16 Oct 2024

The behavior from 4.4/5.2 is the intended behavior and not a bug. Your solution unfortunately actually is a security issue, since it displays unpublished content to public users. We can not accept this. I would advise you to find a different solution for your problem or in worst case copy the module and model and make a change for you alone, but for Joomla this is both a breaking change and a security issue.

avatar NicolasDerumigny
NicolasDerumigny - comment - 16 Oct 2024

My bad, I got confused in my changes, this is the actual patch:

-        $model->setState('filter.published', 1);
+        $user = $app->getIdentity();
+        if ($user && ($user->authorise('core.edit.state')) && ($user->authorise('core.edit'))) {
+            $model->setState('filter.published', array(0, 1));
+        } else {
+            $model->setState('filter.published', 1);
+        }

Edit: note that this only addresses cases for user with the global core.edit / core.edit.state permission. I am unsure whether a more fine-grain solution is doable (e.g. to exactly match the user's category-based permissions).

avatar NicolasDerumigny
NicolasDerumigny - comment - 16 Oct 2024

#42694 adresses issue #42452 which describe exactly a kind if problem listed here: where some publish_up articles are not shown whereas they should. This is a regression, please reopen the issue.

avatar brianteeman
brianteeman - comment - 16 Oct 2024

If the article is not yet published why do you expect it to be displayed

avatar NicolasDerumigny
NicolasDerumigny - comment - 16 Oct 2024

In my use case, several administrators share a website to write content to readers. It is easier for the admins to see on the homepage the next news to be published in a glance, without going individually to all categories.

avatar brianteeman
brianteeman - comment - 16 Oct 2024

For that specific use case you will need to create your own module. It certainly would not be the expected or designed behaviour. I managed many sites where this would result in information being leaked before it should be available.

avatar NicolasDerumigny
NicolasDerumigny - comment - 16 Oct 2024

Well, users with global core.edit have other ways to see / modify to-be-publisged content but I suppose this falls out of the scope of the module, which is either way doomed for death on 6.0.
Thanks for the clarification!

Add a Comment

Login with GitHub to post a comment