Skip to content
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

Merged
merged 22 commits into from
Aug 8, 2019
Merged

Batch copy: copy permission too #24736

merged 22 commits into from
Aug 8, 2019

Conversation

alikon
Copy link
Contributor

@alikon alikon commented Apr 27, 2019

follow up #24730.

Summary of Changes

copy permission when Batch copy items to a new category

Testing Instructions

  • Create an article.
  • Go to its permission tab and make a change. (e.g registered->allow creating)
  • Go to Batch and Copy it somewhere else.

Expected result

the permission are copyied

Actual result

permission are not copied

@alikon alikon changed the title copy permission too Batch copy: copy permission too Apr 27, 2019
@richard67
Copy link
Member

I have tested this item ✅ successfully on c72d6f2

I've tested with 2 articles which had differenc ACL modifications.
Both articles copied in 1 batch action.
Before patch: Copied articles have ACL like in new articles.
After patch: Each of the article copies has ACL like the particular copy source article.

@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.

@viocassel
Copy link
Contributor

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.

@ghost ghost removed the PR-staging label Apr 27, 2019
@ghost
Copy link

ghost commented Apr 27, 2019

Status "Ready To Commit".

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Apr 27, 2019
@richard67 richard67 mentioned this pull request Apr 27, 2019
@wilsonge
Copy link
Contributor

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

@infograf768
Copy link
Member

I agree, for this one, with @wilsonge
I guess we may not need that check for categories and modules.

@wilsonge
Copy link
Contributor

Agreed. The stuff that's component specific is fine. But this generic one needs more careful sanity checks

@alikon
Copy link
Contributor Author

alikon commented Apr 28, 2019

not so sure what "sanity check" you are talking about if target and/or source asset don't exists the query simply does nothing

@infograf768
Copy link
Member

infograf768 commented Apr 28, 2019

I guess just making sure there is an existing asset for the original item.

if ($oldAssetId)

query

@HLeithner HLeithner removed the RTC This Pull Request is Ready To Commit label Jun 5, 2019
@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jun 5, 2019
@infograf768
Copy link
Member

@wilsonge
the rtc label has been taken off without a reply to @alikon
Please explain further what you expect to get this in.

@HLeithner
Copy link
Member

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.

@alikon
Copy link
Contributor Author

alikon commented Jun 5, 2019

for sanity check i've already answered #24736 (comment)
😕

@HLeithner
Copy link
Member

@wilsonge could you please elaborate your comment?

@alikon alikon closed this Aug 3, 2019
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 3, 2019
@richard67
Copy link
Member

@alikon why closing this?

@richard67
Copy link
Member

@alikon Did you maybe accidently hit the wrong button, close instead of rebase?

@alikon
Copy link
Contributor Author

alikon commented Aug 4, 2019

i've had 5 minutes of "send all to the hell" feeling...
...a little bit better now

@alikon alikon reopened this Aug 4, 2019
@richard67
Copy link
Member

@wilsonge The syntax for the join, does the fix for the "ON" which you have done in J4 here a18322d apply also to J3? If so, it should be also fixed here in this PR. I will then make PR for Nicola's branch but want you to confirm if that would be right.

@richard67
Copy link
Member

@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 $this->table->get('id'); would be before that then and reset stuff somehow?

richard67 and others added 2 commits August 4, 2019 13:14
@@ -487,6 +494,21 @@ protected function batchCopy($value, $pks, $contexts)
// Get the new item ID
$newId = $this->table->get('id');

if (!empty($oldAssetId))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Copy rules
// Copy rules
$oldAssetId = $this->table->asset_id;

@alikon
Copy link
Contributor Author

alikon commented Aug 6, 2019

@HLeithner cause i'm not too much able to read only & fully understand code
i've made a test with your suggestion applyied ...... as a result permission are not copyied

so may I ask you to do the same test?
with your suggestion and without (only this silly pr)
........maybe you'll can confirm or deny my results

@@ -487,6 +494,21 @@ protected function batchCopy($value, $pks, $contexts)
// Get the new item ID
Copy link
Contributor

@Quy Quy Aug 7, 2019

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.

Copy link
Member

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.

@richard67
Copy link
Member

@Quy That was what I supposed, too, but seems that comment in code reviews was too hidden.

@richard67
Copy link
Member

Tonight I can test again. But last changes were code style only so my old test should still be ok.

@richard67
Copy link
Member

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.

@richard67
Copy link
Member

@viocassel or @Quy could you test again? Thanks in advance.

@viocassel
Copy link
Contributor

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.

@richard67
Copy link
Member

@viocassel Thanks for testing.

@ghost
Copy link

ghost commented Aug 7, 2019

Status "Ready To Commit".

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 7, 2019
@HLeithner
Copy link
Member

Thank you for your engagement in Joomla!

@HLeithner HLeithner merged commit 107ddfe into joomla:staging Aug 8, 2019
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 8, 2019
@HLeithner HLeithner added this to the Joomla! 3.9.11 milestone Aug 8, 2019
@alikon alikon deleted the patch-118 branch August 13, 2019 06:28
@alikon alikon mentioned this pull request Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants