Code to run code as a named user, not Anonymous (not verified)

I have code that runs a Feed Import i.e.

function cronmonitor40_cron() {
	
		watchdog('cronmonitor40', 'cron 40 has run !!!');
		$name = "church_events_f3";		
		$source = feeds_source($name);
		$source->import();

}

When I run the import via the UI it runs ( as seen in the message log ) as an administrator – and it works ! However when cron runs the code above, it runs as Anonymous(not verified). A watchdog message shows the code is running but the import finds no data to import. But when the job is run via the UI immediately after the code, it does find data. It looks to me like a permission issue, that would be solved if my code was running with administrative privileges – leading to the administrator’s name appearing as the user in the message log.

How do I need to change the above code so that cron recognises the code as having administrator privileges ? Thanks.

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed