User tests: Successful: Unsuccessful:
This PR fixes the issue reported at #7205. When you create a new article and change permission settings for that new article tab, that change is not saved. This happens because a typo in JTableContent class. Because of that typo, the permission settings of the new article which you created is always the same with the default permission settings of com_content component, not depend on the settings you set for that article.
Please note that this issue only happen when you create a new article, not when you edit an article
Create a new article, look at Permissions tab, try to change some permission settings. Save it. You will see that the permission settings you change is not being saved.
Apply this patch
Test again. The permission settings you set for the new article will be saved properly.
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Thanks Brian.
Easy | No | ⇒ | Yes |
Category | ⇒ | ACL Libraries |
Rel_Number | 0 | ⇒ | 7205 |
Relation Type | ⇒ | Pull Request for |
This PR resolves reported error.
Status | Pending | ⇒ | Ready to Commit |
RTC Thanks
Labels |
Added:
?
|
IMHO, this should go in 3.4.2
Bug was introduced with #5230.
While this code works, I'm not that sure it makes much sense. $this->rules
is actually always set as it is declared in JTable
and thus the check will always return false.
I would suggest to use if (!$this->getRules())
instead if you want to check if there are rules specified.
As the original code was supposed to fix frontend editing where the permission tab is absent this needs to be tested on frontend editing as well.
And probably also on PostgreSQL.
Pinging @wilsonge, @alikon and @nikosdion as those were the testers on the original PR. So I suppose they can still test on PostgreSQL
I agree this would be good to have in 3.4.2 but it's Georges call.
isset
returns false for a null variable (which is the case with rules) https://github.com/joomdonation/joomla-cms/blob/patch-15/libraries/joomla/table/table.php#L78 So whether you use that or just check using !
I don't really mind.
I would agree using $this->getRules()
would make logical sense - rather than the class var (as it's more future proof).
Agree with Thomas and made the change. However, I think we might still have a possible issue here. I think when there is no permission set for that article (from frontend form ? haven't checked it yet), the permission settings of that article should be inherited from the category it is assigned to, not from the component settings as in the current code. Am I correct?
I don't think so. I'm pretty sure in the backend it's just using the default permissions for the article (which is the ones for com_content)
isset returns false for a null variable (which is the case with rules)
Ah true. Didn't remember that. I stand corrected
I think when there is no permission set for that article (from frontend form ? haven't checked it yet), the permission settings of that article should be inherited from the category it is assigned to, not from the component settings as in the current code. Am I correct?
George is right here. We don't need to inherit the permissions from the category. Otherwise you would have to change all article permissions if the category permissions are changed.
In fact we can just save an empty rule ({}
) to use the defaults from either category or component. Our ACL will calculate that on rumtime when needed.
Status | Ready to Commit | ⇒ | Pending |
Set back to Pending
Milestone |
Added: |
@wilsonge I checked it again and saw that you are correct. When we create a new article from backend, the default permission settings is set from com_content permission settings, so you are correct.
@Bakual That's what I thought, set it to empty rule so that every permissions is "Inherited" and make it inherit permission from the category it was assigned to. However, as George pointed out, it is not how it works when the article is created from backend, so we will leave it as how it is.
Could @brianteeman and @jwaisner re-test it so that we can get this bug fixed in 3.4.2?
Tested with
So I think this one is save for merging. Setting back to RTC.
If someone can run a test on PostgreSQL that would still be great.
Status | Pending | ⇒ | Ready to Commit |
tested on MSSQL and Postgresql and works well
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-06-23 23:07:27 |
Closed_By | ⇒ | wilsonge |
Merged - thanks guys :)
Labels |
Removed:
?
|
Issue observed on creating a NEW article. PR resolves the issue - thanks
This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7223.