public function getAuthorisedCategories($component, $action)
	{
		// Brute force method: get all published category rows for the component and check each one
		// TODO: Move to ORM-based models
		$db = \App::get('db');
		$query = $db->getQuery()
			->select('c.id', 'id')
			->select('a.name', 'asset_name')
			->from('#__categories', 'c')
			->join('#__assets AS a', 'c.asset_id', 'a.id', 'inner')
			->whereEquals('c.extension', $component)
			->whereEquals('c.published', '1');
		$db->setQuery($query->toString());

		$allCategories = $db->loadObjectList('id');

		$allowedCategories = array();

		foreach ($allCategories as $category)
		{
			if ($this->authorise($action, $category->asset_name))
			{
				$allowedCategories[] = (int) $category->id;
			}
		}

		return $allowedCategories;
	}
public function getAuthorisedCategories($component, $action)
	{
		// Brute force method: get all published category rows for the component and check each one
		// TODO: Move to ORM-based models
		$db = \App::get('db');
		$query = $db->getQuery()
			->select('c.id', 'id')
			->select('a.name', 'asset_name')
			->from('#__categories', 'c')
			->join('#__assets AS a', 'c.asset_id', 'a.id', 'inner')
			->whereEquals('c.extension', $component)
			->whereEquals('c.published', '1');
		$db->setQuery($query->toString());

		$allCategories = $db->loadObjectList('id');

		$allowedCategories = array();

		foreach ($allCategories as $category)
		{
			if ($this->authorise($action, $category->asset_name))
			{
				$allowedCategories[] = (int) $category->id;
			}
		}

		return $allowedCategories;
	}
public function getAuthorisedCategories ( $ component , $ action ) { // Brute force method: get all published category rows for the component and check each one // TODO: Move to ORM-based models $ db = \ App :: get ( 'db' ) ; $ query = $ db -> getQuery ( ) -> select ( 'c.id' , 'id' ) -> select ( 'a.name' , 'asset_name' ) -> from ( '#__categories' , 'c' ) -> join ( '#__assets AS a' , 'c.asset_id' , 'a.id' , 'inner' ) -> whereEquals ( 'c.extension' , $ component ) -> whereEquals ( 'c.published' , '1' ) ; $ db -> setQuery ( $ query -> toString ( ) ) ; $ allCategories = $ db -> loadObjectList ( 'id' ) ; $ allowedCategories = array ( ) ; foreach ( $ allCategories as $ category ) { if ( $ this -> authorise ( $ action , $ category -> asset_name ) ) { $ allowedCategories [ ] = ( int ) $ category -> id ; } } return $ allowedCategories ; }
Method to return a list of all categories that a user has permission for a given action

@param   string  $component  The component from which to retrieve the categories
@param   string  $action     The name of the section within the component from which to retrieve the actions.
@return  array   List of categories that this group can do this action to (empty array if none). Categories must be published.
@since   2.1.0
Method to return a list of all categories that a user has permission for a given action