Access denied after clicking save

sharepoint2010
codeplex

#1

Hi,

I'm getting a "access denied" error when I click on the save button after clicking to edit a user. Creating and deleting works fine. I'm running the app with RequireSiteAdministrator set to false.

Any ideas?

Peter


#2

I think the problem is that updating another person's SPUser object probably requires more permissions than the user has, if they're not an administrator.  Try updating the code to run with elevated privileges (SPSecurity.RunWithElevatedPrivileges).


#3

Does not seem to work :(


#4

In that case i'd probably do a debug on it to find out the exact line causing the access denied, which will hopefully give you a clue as to the problem.  But it's probably a permissions issue.  Also, make sure that the SPSecurity.RunWithElevatedPrivileges is being used properly - you can't use SPContext.Current with it.  You can look at MembershipRequest.cs for an example.


#5

The error is thrown at "spuser.Update();" in UserEdit.aspx.cs.

I've tried this:
SPSecurity.RunWithElevatedPrivileges(delegate() {
spuser.Update();  
 });

But it does not work but then again I'm not a real developer :)


#6

That's not going to work because spuser has to be defined within RunWithElevatedPrivileges - check MembershipRequest.cs for examples.  If you do need one on one help and custom code modifications, we do offer that with our support plan. Check http://www.visigo.com/purchase.html.