Joomla doesn't recognize user in checking permissions from `cv` - can't send CiviMail
This is basically CRM-17968 continued for Joomla (the late comments show that it was never resolved in 4.7.4 as it was for the other CMSes).
This means that
cv api Job.process_mailing --user=cronuser will fail with
API permission check failed for Group/get call; insufficient permission: require access CiviCRM
In this scenario, you can retrieve the Joomla user ID from the session
$userId = CRM_Core_Session::singleton()->get('ufID');
but when a null value is supplied to
JFactory::getUser(), it doesn't return a Joomla user object.
So, a quick solution is to simply retrieve the user ID from the session and supply it to
JFactory::getUser(), but that's a hacky workaround. Something isn't working quite right in this scenario.
I think there may be something more fundamental that isn't bootstrapping right.
Unfortunately, that means that the CiviMail scheduled job breaks for a lot of Joomla sites. See related reports: