Skip to content

Commit

Permalink
Fixed no access error for new item button, when current user has no a…
Browse files Browse the repository at this point in the history
…ccess to types manager
  • Loading branch information
ggppdk committed May 31, 2018
1 parent 0bf2ebc commit 9a1b400
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
7 changes: 5 additions & 2 deletions admin/views/types/view.html.php
Expand Up @@ -40,6 +40,7 @@ function display( $tpl = null )
$jinput = $app->input;
$option = $jinput->get('option', '', 'cmd');
$view = $jinput->get('view', '', 'cmd');
$layout = $jinput->get('layout', 'default', 'cmd');

$cparams = JComponentHelper::getParams( 'com_flexicontent' );
$user = JFactory::getUser();
Expand Down Expand Up @@ -114,8 +115,10 @@ function display( $tpl = null )
$perms = FlexicontentHelperPerm::getPerm();

// Create Submenu (and also check access to current view)
FLEXIUtilities::ManagerSideMenu('CanTypes');

$layout === 'typeslist'
? FLEXIUtilities::ManagerSideMenu(null)
: FLEXIUtilities::ManagerSideMenu('CanTypes');

// Create document/toolbar titles
$doc_title = JText::_( 'FLEXI_TYPES' );
$site_title = $document->getTitle();
Expand Down
12 changes: 10 additions & 2 deletions site/classes/helpers/flexiutilities.php
Expand Up @@ -728,11 +728,19 @@ static function ManagerSideMenu($cando = null)
$session = JFactory::getSession();
$cparams = JComponentHelper::getParams( 'com_flexicontent' );

// Redirect to Joomla backend
if (!$perms->CanManage)
{
$app->redirect('index.php', JText::_('FLEXI_NO_ACCESS'), 'warning');
}

// Check access to current management tab
$is_authorized = $cando === null || $perms->$cando;
if ( !$is_authorized )

// Redirect to Flexicontent backend Dashboard
if (!$is_authorized)
{
$app->redirect('index.php?option=com_flexicontent', JText::_( 'FLEXI_NO_ACCESS' ), 'warning');
$app->redirect('index.php?option=com_flexicontent', JText::_('FLEXI_NO_ACCESS'), 'warning');
}

// Get post-installation FLAG (session variable), and current view (HTTP request variable)
Expand Down

0 comments on commit 9a1b400

Please sign in to comment.