I need to execute a block of code in apex class with context/visibility of a specific user. This user is mentioned in a custom field of a custom object. The need is similar to System.Runas() method however this method can be used only in test class not in apex class. Without using 'with sharing' apex class will run in system admin context and using 'with sharing' it will run with the context of user who invoked the transaction. However in my case it should be any of these two but a specific user. Is there any solution or workaround for this?