Some Views in custom component will not allow deletes

91 views
Skip to first unread message

tomfuller

unread,
Jun 18, 2013, 11:24:27 PM6/18/13
to joomla-de...@googlegroups.com
When I try to "Empty Trash" from some views I get "Warning Delete not permitted"

I am a super user and permissions granted for core.delete in the access.xml file for the component.

Most views will allow, just some - randomly.

What file in the CMS is being called on for this?

if ($this->state->get('filter.published') == -2 && $this->canDo->get('core.delete'))
        {
            JToolBarHelper::deleteList('', 'mediafiles.delete', 'JTOOLBAR_EMPTY_TRASH');
        }

mediafiles is the list view.

I cannot see any differences in the models, controllers, or views - some work, some do not.

Any ideas would be appreciated!


Viper

unread,
Jun 19, 2013, 1:03:28 AM6/19/13
to joomla-de...@googlegroups.com
"Most views will allow, just some - randomly." - most likely it never worked as it should.
'mediafiles.delete' I think this call 'controller.task'.

ModaCalcio.com - e-reall ebay

unread,
Jun 19, 2013, 2:24:23 AM6/19/13
to joomla-de...@googlegroups.com

Check also linux files permissions , they should be editable by www-data

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To post to this group, send an email to joomla-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-general.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

tomfuller

unread,
Jun 19, 2013, 5:01:37 PM6/19/13
to joomla-de...@googlegroups.com
I fixed this by doing two things:

1. Make sure that the assets match the record. In libraries/joomla/table/table.php the delete function checks for asset match.

2. Make sure that the canDelete() function the item model is correct:

/**
     * Method to test whether a record can be deleted.
     *
     * @param   object $record  A record object.
     *
     * @return  boolean  True if allowed to delete the record. Defaults to the permission for the component.
     *
     * @since    1.6
     */
    protected function canDelete($record)
    {
        $user = JFactory::getUser();

        return $user->authorise('core.delete', 'componentname.itemview.' . (int) $record->id);
    }

These (component name and itemview) are set in the access.xml file in the root of the component's admin.
Reply all
Reply to author
Forward
0 new messages