Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.4] Fix Toolbar access check when the content is filtered by multiple categories #44060

Open
wants to merge 3 commits into
base: 4.4-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
$canDo = ContentHelper::getActions('com_contact', 'category', $this->state->get('filter.category_id'));
// Get allowed actions from the component or category (but only when filtering by single category)
$catid = $this->state->get('filter.category_id', 0);
$catid = is_array($catid) ? (count($catid) === 1 ? reset($catid) : 0) : $catid;
$canDo = ContentHelper::getActions('com_contact', 'category', $catid);
$user = Factory::getApplication()->getIdentity();

// Get the toolbar object instance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,10 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
$canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id'));
// Get allowed actions from the component or category (but only when filtering by single category)
$catid = $this->state->get('filter.category_id', 0);
$catid = is_array($catid) ? (count($catid) === 1 ? reset($catid) : 0) : $catid;
$canDo = ContentHelper::getActions('com_content', 'category', $catid);
$user = $this->getCurrentUser();
$toolbar = Toolbar::getInstance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ public function display($tpl = null)
*/
protected function addToolbar()
{
$canDo = ContentHelper::getActions('com_content', 'category', $this->state->get('filter.category_id'));
// Get allowed actions from the component or category (but only when filtering by single category)
$catid = $this->state->get('filter.category_id', 0);
$catid = is_array($catid) ? (count($catid) === 1 ? reset($catid) : 0) : $catid;
$canDo = ContentHelper::getActions('com_content', 'category', $catid);
$user = Factory::getApplication()->getIdentity();
$toolbar = Toolbar::getInstance();

Expand Down