Under what permissions/priviledge does the runwithelevatedprivileges code run?
-
10-12-2019 - |
Question
SPSecurity.RunWithElevatedPrivileges Method Executes the specified method with Full Control rights even if the user does not otherwise have Full Control.
1) But which under which account does this code run?
I read that it runs under the SYSTEM ACCOUNT.
a. what is this system account refers to?
Is it the account used to create the web application or is it the account used to create the site collection. Or is it the SHAREPOINT\SYSTEM (what is this account, from where did it come?) what?
2) It is said that the code inside this runs under Full Control rights. But then, don't we have to add this particular user (say SYSTEM ACCOUNT?) into any of the groups (member) on our site so that he get the full control?
Solution
Please check MSDN: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spsecurity.runwithelevatedprivileges(v=office.14).aspx
Executes the specified method with Full Control rights even if the user does not otherwise have Full Control.
Parameters secureCode Type: Microsoft.SharePoint.SPSecurity.CodeToRunElevated A delegate method that is to run with elevated rights. This method runs under the Application Pool identity, which has site collection administrator privileges on all site collections hosted by that application pool.
OTHER TIPS
It runs under the permissions of the System Account of the WebApplication. The System account is the account with which the App Pool of the Web Application is configured.