Skip to content

Commit

Permalink
copy permission too
Browse files Browse the repository at this point in the history
  • Loading branch information
alikon authored Apr 27, 2019
1 parent 94a068f commit c72d6f2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libraries/src/MVC/Model/AdminModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ protected function batchCopy($value, $pks, $contexts)
}

$newIds = array();
$db = $this->getDbo();

// Parent exists so let's proceed
while (!empty($pks))
Expand Down Expand Up @@ -435,6 +436,7 @@ protected function batchCopy($value, $pks, $contexts)
}
}

$oldAssetId = $this->table->asset_id;
$this->generateTitle($categoryId, $this->table);

// Reset the ID because we are making a copy
Expand Down Expand Up @@ -487,6 +489,18 @@ protected function batchCopy($value, $pks, $contexts)
// Get the new item ID
$newId = $this->table->get('id');

// Copy rules
$query = $db->getQuery(true);
$query->clear()
->update($db->quoteName('#__assets', 't'))
->join('INNER', $db->quoteName('#__assets', 's') .
' ON ' . $db->quoteName('s.id') . ' = ' . $oldAssetId
)
->set($db->quoteName('t.rules') . ' = ' . $db->quoteName('s.rules'))
->where($db->quoteName('t.id') . ' = ' . $this->table->asset_id);

$db->setQuery($query)->execute();

$this->cleanupPostBatchCopy($this->table, $newId, $pk);

// Add the new ID to the array
Expand Down

0 comments on commit c72d6f2

Please sign in to comment.