My goal: to have a field on Account that is read-only for everyone (including System Administrator) but the field can still be edited by Apex code. For example, when an Opportunity is closed as won, an Apex trigger (on the Opportunity object) will find the associated Account and update the read-only field.
Ideally, I would like there to be an Account trigger that checks to see if the update was performed by a user or by Apex code. If it was performed by a user, an error is returned saying that the user is not allowed to edit the field. If it was performed by the Apex code, the update goes through.
Is there any easy way to do this?