I want to know under which account does code present in web parts, user controls, timer jobs, JSOM on masterpage run?
2 Answers
-Web Part: Code executes as the user logged in. Runs in w3wp.exe (worker process)
-User Control: Code executes as the user logged in. Runs in w3wp.exe (worker process)
-JSOM: Code executes as the user logged in to the workstation (since it's client side). Runs in the browser process.
-Timer job: Code executes as the SharePoint Farm Account or simply the user which runs OWSTimer Service. Runs in OWSTIMER.EXE (the SharePoint timer service).
Exceptions for web part, user control and (technically) the timer job: If a block of code is executed in the scope of RunWithElevatedPrivileges or (better) impersonation via the use of the SPUserToken of another account (e.g. System Account, your co-worker's account, etc.).
-
1Timer job runs under SharePoint Farm Account or the user which runs OWSTimer service. Not necessarily system account. Commented Apr 9, 2014 at 5:41
-
Good catch - it's getting too late where I'm at. I really did mean to say farm account instead of system account :) Commented Apr 9, 2014 at 5:43
-
-
-
can you also update your answer to mention the processname under which the things run (w3p or OWSTimer), please– variableCommented Apr 10, 2014 at 6:42
AFAIK.. Web Parts, User Controls and JSOM either on MasterPage or any page uses the current logged in user credentials until you run the code under RunWithElevatedPrivileges which uses Application Pool identity..
However timer jobs run under SharePoint farm account or simply the user which runs OWSTimer service.