Fixes #39 to ensure components are build even if created and modified dates are not set. Improved #37 #issuecomment-278372267 to avoid one line error in windows.

This commit is contained in:
2017-02-09 18:11:10 +02:00
parent 3497de7c28
commit 5b5599575b
253 changed files with 20214 additions and 16025 deletions

View File

@ -60,33 +60,14 @@ class ComponentbuilderControllerFieldtype extends JControllerForm
*/
protected function allowAdd($data = array())
{
// get the user object
$user = JFactory::getUser();
// Access check.
$access = $user->authorise('fieldtype.access', 'com_componentbuilder');
$access = JFactory::getUser()->authorise('fieldtype.access', 'com_componentbuilder');
if (!$access)
{
return false;
}
$categoryId = JArrayHelper::getValue($data, 'catid', $this->input->getInt('filter_category_id'), 'int');
$allow = null;
if ($categoryId)
{
// If the category has been passed in the URL check it.
$allow = $user->authorise('core.create', $this->option . '.fieldtypes.category.' . $categoryId);
}
if ($allow === null)
{
// In the absense of better information, revert to the component permissions.
return $user->authorise('fieldtype.create', $this->option);
}
else
{
return $allow;
}
// In the absense of better information, revert to the component permissions.
return JFactory::getUser()->authorise('fieldtype.create', $this->option);
}
/**
@ -146,18 +127,6 @@ class ComponentbuilderControllerFieldtype extends JControllerForm
}
return false;
}
$categoryId = (int) isset($data['catid']) ? $data['catid']: $this->getModel()->getItem($recordId)->catid;
if ($categoryId)
{
// The category has been set. Check the category permissions.
$catpermission = $user->authorise('core.edit', $this->option . '.fieldtypes.category.' . $categoryId);
if (!$catpermission && !is_null($catpermission))
{
return false;
}
}
}
// Since there is no permission, revert to the component permissions.
return $user->authorise('fieldtype.edit', $this->option);