0

Please consider following scenario:

public override void ItemUpdated(SPItemEventProperties properties)
{
   SPSecurity.RunWithElevatedPrivileges(delegate()
   {
       SPWeb web1 = properties.Web;  //this SPWeb object will have permissions of 
                                     //current user, regardless of running inside RWEP
       SPWeb web2 = properties.OpenWeb();  //what permissions has this SPWeb object?
    });
 }

In event receiver, if I want to use Web from properties, then it will have permissions of current user, regardless of RWEP block. That's why I always created new instance of SPSite and SPWeb inside of RWEP block.

What permissions will SPWeb object have, if it is returned from OpenWeb() method called inside of RWEP? Permissions of current user or permissions of System Account?

1
  • 2
    Current User, since the Site is in scope, and that one is opened as the current user Sep 3 '13 at 12:59
0

Current user, because properties don't run under elevated privileges. But why you don't try it yourself? You wrote the code yourself, you only need to debug. :)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.