? ?

Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
20 Feb 2021

Pull Request for Issue #32117.

Summary of Changes

This PR improves frontend article submission form so that the form will respect permission of the pre-selected category (which is selected in the menu item parameter). See #32117 to understand the issue better

Testing Instructions

  1. Create a new user account, assign the account to Author user group.
  2. Edit an existing article category (or create a new category), in the Permissions tab, make sure Edit State permission for Author user group is set to Allowed.
  3. Create a menu item to link to Create Article menu option.
  4. Login to frontend using the user account which belong to Author user group above, access to the menu item to try to submit article:
  • Before patch: You do not have Edit State permission, so you cannot change settings such as Published, Start Publishing, Start Featured....
  • After patch: You can select status for the article (for example Published), select date For Start Publishing, Start Featured.. (in Publish tab)
avatar joomdonation joomdonation - open - 20 Feb 2021
avatar joomdonation joomdonation - change - 20 Feb 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 20 Feb 2021
Category Administration com_content Front End
avatar Razzo1987 Razzo1987 - test_item - 20 Feb 2021 - Not tested
avatar Razzo1987
Razzo1987 - comment - 20 Feb 2021

I have not tested this item.

We have follow the steps and it work correctly before apply the patch

User as Author:
immagine
Category with permission:
immagine
Article create as unpublished:
immagine

If the user is Publisher:
immagine
He can change the article statement:
immagine

We think this way is correct


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32468.
avatar joomdonation joomdonation - change - 20 Feb 2021
Labels Added: ?
avatar joomdonation
joomdonation - comment - 20 Feb 2021

Hello @Razzo1987

Maybe my testing instructions is not clear. Please give Author user group edit state permission for the category, then access to create article form:

  • Before patch: Although the author has edit state permission in the category, he cannot change Status, Start Publishing... while submitting article to that pre-selected category
  • After path: The author can now change Status of article, select Start Publishing... while submitting article to that category (expected behavior)

Hope it is clear now.

avatar Razzo1987
Razzo1987 - comment - 20 Feb 2021

Category permission for Author:
immagine

Before the patch the user can create the article as unpublished and then change it to published. He can not select Featured and Start/Finish Publishing

After the patch he can directly create the article as published and sect the info

avatar Razzo1987 Razzo1987 - test_item - 20 Feb 2021 - Tested successfully
avatar Razzo1987
Razzo1987 - comment - 20 Feb 2021

I have tested this item successfully on 8daf88b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32468.

avatar Razzo1987
Razzo1987 - comment - 20 Feb 2021

I have tested this item successfully on 8daf88b


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32468.

avatar infograf768
infograf768 - comment - 20 Feb 2021

Please resolve conflicts

avatar joomdonation
joomdonation - comment - 20 Feb 2021

@infograf768 Done !

avatar infograf768
infograf768 - comment - 21 Feb 2021

After patch one can indeed set the Start Featured, Finish Featured, Start Publishing, Finish Publishing fields, but not the Published state which is obtained by the Workflow field.

Screen Shot 2021-02-21 at 08 56 09

Screen Shot 2021-02-21 at 08 56 33

The Author can never Publish the article.

Is that what you expect? If yes, then PR is fine.

avatar joomdonation
joomdonation - comment - 21 Feb 2021

@infograf768 I don't understand how workflow works yet, so I'm unsure about it. However, from what we can see in the code (even before this PR), if someone has edit state permission, he should be allowed to change start publishing..., see the code block here https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_content/src/Model/ArticleModel.php#L533

So this PR is fine.

avatar infograf768
infograf768 - comment - 21 Feb 2021

In the original code you quote, we have
|| ($id == 0 && !$user->authorise('core.edit.state', 'com_content')))

[...]
$form->setFieldAttribute('state', 'disabled', 'true');

But ('core.edit.state', 'com_content') is a general Option for com_content and its default is Not Allowed for Author:

Screen Shot 2021-02-21 at 10 26 26

Therefore, we can't expect the Author to be able to Publish the new article, as stated in the PR description.

After patch: You can select status for the article (for example Published), select date For Start Publishing, Start Featured.. (in Publish tab)

Thus why I was posting my comment. :)

Please modify description and confirm the PR only deals with Start Featured, Finish Featured, Start Publishing, Finish Publishing fields and I will test it OK as only Publisher can publish. ;)

avatar infograf768
infograf768 - comment - 21 Feb 2021

@bembelimen Any input here?

avatar joomdonation
joomdonation - comment - 21 Feb 2021

@infograf768 Start Featured, Finish Featured, Start Publishing, Finish Publishing is treated the same with Status. The Author does not have edit state permission by default in com_content, however, he is submitting article to a Category which Author user group has Edit State Permission set to Allowed and that's the reason he can modify these data (Start Featured, Finish Featured, Start Publishing, Finish Publishing)

avatar joomdonation
joomdonation - comment - 21 Feb 2021

To be more clear, all this PR does is change the logic of Edit State Permission check from this block of code https://github.com/joomla/joomla-cms/blob/4.0-dev/administrator/components/com_content/src/Model/ArticleModel.php#L533

  • Before this PR, when submit new article to a category, the Edit State Permission is not inherited from the category the article is submitted to, that's the reason Author could not enter data for Status, Start Featured, Finish Featured, Start Publishing, Finish Publishing (although he has Edit State Permission set to Allowed for that category)
  • After this PR, Author can change these data while submitting article as expected

When submit article, the permission should be inherited from the pre-selected category (in the menu item setup), not inherit permission directly from com_content. If it is needed, you can read the issue description #32117 to understand the real issue this PR solves it.

avatar infograf768
infograf768 - comment - 21 Feb 2021

Ok, I think I understood the confusion.

ref: #32117

That issue defines a problem when Workflow is NOT implemented.
That is THE important aspect to know.
In that case, we have a Status field (and not Workflow), readonly, and set to Published by default and your PR makes sense.

Please modify description. ;)

avatar joomdonation
joomdonation - comment - 21 Feb 2021

@infograf768 I'm unsure what I need to modify to the PR description? I haven't use nor understand how workflow works, so I don't know what I have to write there.

avatar toivo toivo - test_item - 21 Feb 2021 - Tested successfully
avatar toivo
toivo - comment - 21 Feb 2021

I have tested this item successfully on cfad50a

Tested successfully in Beta8-dev in Wampserver 3.2.4 using Apache 2.4.46c, MySQL 8.0.23 and PHP 8.0.2.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32468.

avatar infograf768 infograf768 - test_item - 21 Feb 2021 - Tested successfully
avatar infograf768
infograf768 - comment - 21 Feb 2021

I have tested this item successfully on cfad50a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32468.

avatar infograf768 infograf768 - change - 21 Feb 2021
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 21 Feb 2021

Rtc

Note that the Status field with Published as default will only display when workflow is off.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32468.

avatar joomdonation joomdonation - change - 27 Feb 2021
Labels Added: ?
avatar rdeutz rdeutz - close - 10 Mar 2021
avatar rdeutz rdeutz - merge - 10 Mar 2021
avatar rdeutz rdeutz - change - 10 Mar 2021
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-03-10 10:12:32
Closed_By rdeutz

Add a Comment

Login with GitHub to post a comment