Skip to content

Commit

Permalink
Merge pull request #22 from joomdonation/remove_view_logs_permission
Browse files Browse the repository at this point in the history
Move view logs permission check from view to controller
thanks @joomdonation
  • Loading branch information
alikon authored May 9, 2018
2 parents a1ba21b + f357aff commit c217dc9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
26 changes: 26 additions & 0 deletions administrator/components/com_userlogs/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,30 @@
*/
class UserlogsController extends JControllerLegacy
{
/**
* Method to display a view.
*
* @param boolean $cachable If true, the view output will be cached
* @param array $urlparams An array of safe URL parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return UserlogsController This object to support chaining.
*
* @since __DEPLOY_VERSION__
*/
public function display($cachable = false, $urlparams = array())
{
$view = $this->input->get('view', 'userlogs');

switch ($view)
{
case 'userlogs':
if (!JFactory::getUser()->authorise('core.viewlogs', 'com_userlogs'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
break;
}

return parent::display();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,6 @@ class UserlogsViewUserlogs extends JViewLegacy
*/
public function display($tpl = null)
{
if (!JFactory::getUser()->authorise('core.viewlogs', 'com_userlogs'))
{
throw new JAccessExceptionNotallowed(JText::_('JERROR_ALERTNOAUTHOR'), 403);
}

if (PluginHelper::isEnabled('system', 'userlogs'))
{
$params = new Registry(PluginHelper::getPlugin('system', 'userlogs')->params);
Expand Down

0 comments on commit c217dc9

Please sign in to comment.