Skip to content

Commit

Permalink
Merge pull request #7824 from infograf768/notauthorised
Browse files Browse the repository at this point in the history
Frontend: Changing JError to enqueueMessage when access is not permitted (Solves partly #7812
  • Loading branch information
Kubik-Rubik committed Sep 14, 2015
2 parents f1d0d71 + da15e6a commit 379ab86
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
4 changes: 3 additions & 1 deletion components/com_contact/views/contact/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ public function display($tpl = null)

if ((!in_array($item->access, $groups)) || (!in_array($item->category_access, $groups)))
{
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$app->setHeader('status', 403, true);

return;
}

Expand Down
3 changes: 2 additions & 1 deletion components/com_content/views/article/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ public function display($tpl = null)
// Check the view access to the article (the model has already computed the values).
if ($item->params->get('access-view') == false && ($item->params->get('show_noauth', '0') == '0'))
{
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$app->setHeader('status', 403, true);

return;
}
Expand Down
4 changes: 3 additions & 1 deletion components/com_content/views/form/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class ContentViewForm extends JViewLegacy
public function display($tpl = null)
{
$user = JFactory::getUser();
$app = JFactory::getApplication();

// Get model data.
$this->state = $this->get('State');
Expand All @@ -52,7 +53,8 @@ public function display($tpl = null)

if ($authorised !== true)
{
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$app->setHeader('status', 403, true);

return false;
}
Expand Down
3 changes: 2 additions & 1 deletion components/com_newsfeeds/views/newsfeed/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ public function display($tpl = null)

if (!in_array($item->access, $levels) or ((in_array($item->access, $levels) and (!in_array($item->category_access, $levels)))))
{
JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$app->setHeader('status', 403, true);

return;
}
Expand Down
3 changes: 2 additions & 1 deletion components/com_users/controllers/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ public function edit()
// Check if the user is trying to edit another users profile.
if ($userId != $loginUserId)
{
JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$app->setHeader('status', 403, true);

return false;
}
Expand Down

0 comments on commit 379ab86

Please sign in to comment.