1

I would like to check out items, that are edited by user XYZ.

Well, it works so far: If somebody opens an item, the default-view shows the "lock" icon.

But: If I click the link to the checked out item, I can access the item without problems, where it should say Direct access not allowed or something like that.

I inserted this into my default-view:

$ordering   = ($listOrder == 'a.ordering');
$canCreate  = $user->authorise('core.create',       'com_bestia');
$canEdit    = $user->authorise('core.edit',         'com_bestia');
$canCheckin = $user->authorise('core.manage',       'com_bestia');
$canChange  = $user->authorise('core.edit.state',   'com_bestia');
...

<?php if ($item->checked_out) : ?>
    <?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'users.', $canCheckin); ?>
<?php endif; ?>                                             
...

My controller has the following display-method:

public function display($cachable = false, $urlparams = false) 
{
    require_once JPATH_COMPONENT . '/helpers/bestia.php';

    $view   = $this->input->get('view');
    $layout = $this->input->get('layout');
    $id     = $this->input->getInt('id');

    // Check for edit form.
    if ($view == 'user' && $layout == 'edit' && !$this->checkEditId('com_bestia.edit.user', $id))
    {
        // Somehow the person just went to the form - we don't allow that.
        $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
        $this->setMessage($this->getError(), 'error');
        $this->setRedirect(JRoute::_('index.php?option=com_bestia&view=user', false));

        return false;
    }

    parent::display($cachable, $urlparams);

    return $this;
}

How can I solve this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.