Skip to content

Commit

Permalink
Fix allowEdit check for module (#17838)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderpotjer authored and Michael Babker committed Sep 3, 2017
1 parent 79b7d9c commit 74c6584
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions administrator/components/com_modules/controllers/module.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,19 @@ protected function allowEdit($data = array(), $key = 'id')
$recordId = (int) isset($data[$key]) ? $data[$key] : 0;
$user = JFactory::getUser();

// Check general edit permission first.
// Zero record (id:0), return component edit permission by calling parent controller method
if (!$recordId)
{
return parent::allowEdit($data, $key);
}

// Check edit on the record asset (explicit or inherited)
if ($user->authorise('core.edit', 'com_modules.module.' . $recordId))
{
return true;
}

// Since there is no asset tracking, revert to the component permissions.
return parent::allowEdit($data, $key);
return false;
}

/**
Expand Down

0 comments on commit 74c6584

Please sign in to comment.