Skip to content

Commit

Permalink
Merge pull request #4 from chmst/Menu_ACL
Browse files Browse the repository at this point in the history
Respect Hathor once more
  • Loading branch information
bembelimen committed Apr 11, 2016
2 parents eb71254 + c4645d0 commit 1a96f6c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
$ordering = ($listOrder == 'a.lft');
$canOrder = $user->authorise('core.edit.state', 'com_menus');
$saveOrder = ($listOrder == 'a.lft' && $listDirn == 'asc');
$menutypeid = (int) $this->state->get('menutypeid');
$assoc = JLanguageAssociations::isEnabled();
?>

Expand Down Expand Up @@ -136,10 +137,10 @@
<?php
foreach ($this->items as $i => $item) :
$orderkey = array_search($item->id, $this->ordering[$item->parent_id]);
$canCreate = $user->authorise('core.create', 'com_menus');
$canEdit = $user->authorise('core.edit', 'com_menus');
$canCreate = $user->authorise('core.create', 'com_menus.menu.' . $menutypeid);
$canEdit = $user->authorise('core.edit', 'com_menus.menu.' . $menutypeid);
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $user->get('id')|| $item->checked_out == 0;
$canChange = $user->authorise('core.edit.state', 'com_menus') && $canCheckin;
$canChange = $user->authorise('core.edit.state', 'com_menus.menu.' . $menutypeid) && $canCheckin;
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="center">
Expand Down
17 changes: 16 additions & 1 deletion administrator/templates/hathor/html/com_menus/menu/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,25 @@
<?php echo $this->form->getInput('description'); ?></li>
</ul>
</fieldset>
</div>
<div class="clr"></div>
<?php if ($this->canDo->get('core.admin')) : ?>
<div class="col rules-section">
<?php echo JHtml::_('sliders.start', 'permissions-sliders-' . $this->item->id, array('useCookie' => 1)); ?>

<?php echo JHtml::_('sliders.panel', JText::_('COM_MENUS_FIELDSET_RULES'), 'access-rules'); ?>
<fieldset class="panelform">
<legend class="element-invisible"><?php echo JText::_('COM_CONTENT_FIELDSET_RULES'); ?></legend>
<?php echo $this->form->getLabel('rules'); ?>
<?php echo $this->form->getInput('rules'); ?>
</fieldset>

<?php echo JHtml::_('sliders.end'); ?>
</div>
<?php endif; ?>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</div>

</form>
<div class="clr"></div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,19 @@
$canCreate = $user->authorise('core.create', 'com_menus');
$canEdit = $user->authorise('core.edit', 'com_menus');
$canChange = $user->authorise('core.edit.state', 'com_menus');
$canManageItems = $user->authorise('core.manage', 'com_menus.menu.' . (int) $item->id);
?>
<tr class="row<?php echo $i % 2; ?>">
<td class="center">
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
</td>
<td>
<a href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype='.$item->menutype) ?> ">
<?php if ($canManageItems) : ?>
<a href="<?php echo JRoute::_('index.php?option=com_menus&view=items&menutype=' . $item->menutype); ?>">
<?php echo $this->escape($item->title); ?></a>
<?php else : ?>
<?php echo $this->escape($item->title); ?>
<?php endif; ?>
<p class="smallsub">(<span><?php echo JText::_('COM_MENUS_MENU_MENUTYPE_LABEL') ?></span>
<?php if ($canEdit) : ?>
<?php echo '<a href="'.JRoute::_('index.php?option=com_menus&task=menu.edit&id='.$item->id).' title='.$this->escape($item->description).'">'.
Expand Down

0 comments on commit 1a96f6c

Please sign in to comment.