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
A few improvements for assets #14319
Conversation
… up inherited permissions
Questions about Test Instructions:
Check in each User Group for each Action?
same as above.
sounds like this is the Problem but on testing i see no "reset permissions for other groups" I don't understand the Issue and what to test. |
@franz-wohlkoenig Some time ago I had a bug which reset permission to 'inherit' for other user groups if I only changed permission to 'inherit' for only one user group. [Updated] Please take a look at the new test instruction. |
@csthomas will test today, thanks for Infos. |
Using default user groups:and work your Example:
with and -out PR got in Creating an Article (before |
@franz-wohlkoenig I have made a new better test instruction. Please test again. |
thanks @csthomas will test later. |
After |
Allowed should be preserved/not changed on different user group permission 'Manager'. |
Manager and Editor has the same value 'Allowed' for Edit action field. |
Group |
I suppose you do not understand me, May be I explained it in a wrong way:
On start, these two user groups has to be set as "Allowed". Change permission to "Inherit" for only one user group and save. |
But before you have to toggle to Manager tab to check that. You have to do changes in Editor, but check Manager. |
I have tested this item ✅ successfully on 08d10b2 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14319. |
Thanks for your patience :) |
Thanks for your patience too ;-) |
I have tested this item ✅ successfully on 08d10b2 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/14319. |
RTC after two successful tests. |
After updating to 3.7.3, we got "Invalid parent ID" for our own JTable. Is this commit related? |
@olleharstedt please open a new issue, comments on closed/merged PR get lost |
Please open a new issue, but meantime: You may try to revert Check your table and find which assets rows has invalid parent_id, means parent_id points to not existed row id. Example query: SELECT a.* FROM `#__assets` a LEFT JOIN `#__assets` b ON a.parent_id = b.id WHERE b.id IS NULL The correct result is only one row with |
Thank you. @csthomas Query checks out, only returns |
// JTableNested does not allow parent_id = 0, override this. | ||
if ($this->parent_id > 0) | ||
{ | ||
// Get the JDatabaseQuery object | ||
$query = $this->_db->getQuery(true) | ||
->select('COUNT(id)') | ||
->select('1') |
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.
This does not work on our system, for some reason. Query returns null, but with COUNT(*)
it returns 1, as should be.
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.
Using 1 AS x
also works.
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.
If only this change fix your problem then I do not understand it. What database do you have?
You said that:
SELECT count(*) FROM `#__assets` WHERE id = ?
return 1 and
SELECT 1 FROM `#__assets` WHERE id = ?
return null
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.
Using 1 AS x also works.
OK I can understand the reason.
But I thought that such error exists only in sub-queries generated in mssql.
Removing offset and limit also should fix that, ex:
replace $db->setQuery($query, 0, 1)
to $db->setQuery($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.
Removing limit and offset did not fix the issue.
mysql Ver 14.14 Distrib 5.5.55, for debian-linux-gnu (x86_64) using readline 6.3
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.
PHP 5.5.
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.
Strange thing is, when I run the exact same code in a script using CLI, it works!
Do you know which database driver is used in assets table?
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.
Oh... _db = JFalangDatabase Object
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.
If you think this is a real joomla problem then you can create a PR and add alias to column as you mentioned. I will test it.
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.
No, this is a Falang problem. They override the database driver and can't handle the query. But sure, if Falang won't fix it, it would be nice if the PR would be accepted.
Pull Request for a few fixes from my previous non B/C PR #14279
Summary of Changes
Use inheritance (simple '{}') as in other extensions.
{'core.edit': {}, 'core.delete: {}'}
to{}
JAccessRules::getData()
instead ofjson_decode()
andjson_encode()
in methodJAccessRules::__toString()
asset_id
intests/unit/schema/ddl.sql
Testing Instructions
Manager
from 'Inherit' to 'Allowed' forCreate
,Edit
,Delete
:Edit
action from 'Inherit' to 'Allowed' andSave
.Edit
is as 'Allowed'. Change it to 'Inherit' andSave
.Manager
and check ifEdit
action has not been reset and still has selected 'Allowed'.Expected result
A new article by default inherit permissions from parent category (after stored).
Actual result
A new article after save always has copy of permissions from com_content asset.
Documentation Changes Required
None