Skip to content

Commit

Permalink
Fixing ACL inheritance for fields and fieldgroups
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Hunziker committed Jan 21, 2017
1 parent b222a8d commit cf06d90
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
7 changes: 5 additions & 2 deletions administrator/components/com_fields/tables/group.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ public function check()
*/
protected function _getAssetName()
{
return $this->context . '.fieldgroup.' . (int) $this->id;
$component = explode('.', $this->context)[0];

return $component . '.fieldgroup.' . (int) $this->id;
}

/**
Expand Down Expand Up @@ -155,11 +157,12 @@ protected function _getAssetTitle()
*/
protected function _getAssetParentId(JTable $table = null, $id = null)
{
$component = explode('.', $this->context)[0];
$db = $this->getDbo();
$query = $db->getQuery(true)
->select($db->quoteName('id'))
->from($db->quoteName('#__assets'))
->where($db->quoteName('name') . ' = ' . $db->quote($this->context));
->where($db->quoteName('name') . ' = ' . $db->quote($component));
$db->setQuery($query);

if ($assetId = (int) $db->loadResult())
Expand Down
8 changes: 7 additions & 1 deletion media/system/js/permissions-uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function sendPermissions(event) {

if (document.getElementById('jform_context')){
context = document.getElementById('jform_context').value;
context = context.split('.')[0];
}

if (option == 'com_config' && component == false && extension == false)
Expand All @@ -29,7 +30,12 @@ function sendPermissions(event) {
asset = component;
}
else if (context){
asset = context + '.fieldgroup.' + getUrlParam('id');
if (view == 'group') {
asset = context + '.fieldgroup.' + getUrlParam('id');
}
else {
asset = context + '.field.' + getUrlParam('id');
}
title = document.getElementById('jform_title').value;
}
else if (extension != false && view != false){
Expand Down
2 changes: 1 addition & 1 deletion media/system/js/permissions.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit cf06d90

Please sign in to comment.