0

Is it possible to emulate a different user role in code?

I'm wondering if it is possible to do something similar to Mage_Sales_Model_Order::sendNewOrderEmail() where a different store is emulated i.e.:

$appEmulation = Mage::getSingleton('core/app_emulation');
$initialEnvironmentInfo = $appEmulation->startEnvironmentEmulation($storeId);
...
$appEmulation->stopEnvironmentEmulation($initialEnvironmentInfo).
2
  • Could you provide more information about your question please ? For instance, what is the reason why you want to emulate a user role ? – Raphael at Digital Pianism Jun 20 '16 at 10:52
  • Hi Raphael, we're having issues logging tickets on Zendesk programmatically, and I wanted to emulate an admin user in place of a normal user logging the ticket to test if it was a permissions issue. Obviously the easier and simpler way to do it is to just assign admin rights to the user account I am testing with, but I was curious to know if it were possible to emulate an admin user :) – Skytiger Jun 20 '16 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.