-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Batch copy: copy permission too #24736
Conversation
I have tested this item ✅ successfully on c72d6f2 @HLeithner and @wilsonge Release leads please check as also with PR #24730 if this is a bug fix so it goes into 3.9.next or a new feature for 4.0. This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/24736. |
I have tested this item ✅ successfully on c72d6f2 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/24736. |
Status "Ready To Commit". |
I'm not unhappy to call this a bug fix - but what happens if there isn't a entry in the permissions table for the asset - shouldn't we check in JTable that there actually is a asset_id for items |
I agree, for this one, with @wilsonge |
Agreed. The stuff that's component specific is fine. But this generic one needs more careful sanity checks |
not so sure what "sanity check" you are talking about if target and/or source asset don't exists the query simply does nothing |
I guess just making sure there is an existing asset for the original item.
|
I removed it because George requested more sanity checks, I'm also not sure if this is a bugfix because permission copying is missing or a new feature. Atm I think it's a bugfix but ymmv. |
for sanity check i've already answered #24736 (comment) |
@wilsonge could you please elaborate your comment? |
@alikon why closing this? |
@alikon Did you maybe accidently hit the wrong button, close instead of rebase? |
i've had 5 minutes of "send all to the hell" feeling... |
@wilsonge I just see according to J3 database api doc my previous comment for you is wrong, i.e. this PR here is ok with "... ON ... " in 1 join condition. Is that right? Regarding your sanity check, Nicola has merged noth PRs from @Quy so now it should be ok. Maybe reason why moving things down did not work is because the |
Fix PHPCS for Joomla CMS PR 24736
@@ -487,6 +494,21 @@ protected function batchCopy($value, $pks, $contexts) | |||
// Get the new item ID | |||
$newId = $this->table->get('id'); | |||
|
|||
if (!empty($oldAssetId)) |
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 (!empty($oldAssetId)) | |
if ($this->table->hasField($this->table->getColumnAlias('asset_id')) && !empty($this->table->asset_id)) |
@@ -487,6 +494,21 @@ protected function batchCopy($value, $pks, $contexts) | |||
// Get the new item ID | |||
$newId = $this->table->get('id'); | |||
|
|||
if (!empty($oldAssetId)) | |||
{ | |||
// Copy rules |
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.
// Copy rules | |
// Copy rules | |
$oldAssetId = $this->table->asset_id; |
@HLeithner cause i'm not too much able to read only & fully understand code so may I ask you to do the same test? |
@@ -487,6 +494,21 @@ protected function batchCopy($value, $pks, $contexts) | |||
// Get the new item ID |
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.
After this point $this->table->asset_id
has incremented. Thus the old value must be stored before and not after this point. The PR works as 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.
ok maybe I missed something in the code.
@Quy That was what I supposed, too, but seems that comment in code reviews was too hidden. |
Tonight I can test again. But last changes were code style only so my old test should still be ok. |
I have tested this item ✅ successfully on 6b24187 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/24736. |
@viocassel or @Quy could you test again? Thanks in advance. |
I have tested this item ✅ successfully on 6b24187 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/24736. |
@viocassel Thanks for testing. |
Status "Ready To Commit". |
Thank you for your engagement in Joomla! |
follow up #24730.
Summary of Changes
copy permission when Batch copy items to a new category
Testing Instructions
Expected result
the permission are copyied
Actual result
permission are not copied