diff --git a/administrator/components/com_categories/models/fields/categoryedit.php b/administrator/components/com_categories/models/fields/categoryedit.php index a5fa50bd78f0f..5d76f38d65a77 100644 --- a/administrator/components/com_categories/models/fields/categoryedit.php +++ b/administrator/components/com_categories/models/fields/categoryedit.php @@ -269,7 +269,7 @@ protected function getOptions() * To take save or create in a category you need to have create rights for that category unless the item is already in that category. * Unset the option if the user isn't authorised for it. In this field assets are always categories. */ - if ($user->authorise('core.create', $extension . '.category.' . $option->value) != true && $option->level != 0) + if ($option->level != 0 && !$user->authorise('core.create', $extension . '.category.' . $option->value)) { unset($options[$i]); } @@ -285,40 +285,36 @@ protected function getOptions() */ foreach ($options as $i => $option) { - if ($user->authorise('core.edit.state', $extension . '.category.' . $oldCat) != true && !isset($oldParent)) + $assetKey = $extension . '.category.' . $oldCat; + + if ($option->level != 0 && !isset($oldParent) && $option->value != $oldCat && !$user->authorise('core.edit.state', $assetKey)) { - if ($option->value != $oldCat) - { - unset($options[$i]); - } + unset($options[$i]); + continue; } - if ($user->authorise('core.edit.state', $extension . '.category.' . $oldCat) != true - && (isset($oldParent)) - && $option->value != $oldParent) + if ($option->level != 0 && isset($oldParent) && $option->value != $oldParent && !$user->authorise('core.edit.state', $assetKey)) { unset($options[$i]); + continue; } /* * However, if you can edit.state you can also move this to another category for which you have * create permission and you should also still be able to save in the current category. */ - if (($user->authorise('core.create', $extension . '.category.' . $option->value) != true) - && ($option->value != $oldCat && !isset($oldParent))) + $assetKey = $extension . '.category.' . $option->value; + + if ($option->level != 0 && !isset($oldParent) && $option->value != $oldCat && !$user->authorise('core.create', $assetKey)) { - { - unset($options[$i]); - } + unset($options[$i]); + continue; } - if (($user->authorise('core.create', $extension . '.category.' . $option->value) != true) - && (isset($oldParent)) - && $option->value != $oldParent) + if ($option->level != 0 && isset($oldParent) && $option->value != $oldParent && !$user->authorise('core.create', $assetKey)) { - { - unset($options[$i]); - } + unset($options[$i]); + continue; } } }