We have this WebPart that uploads content the shared documents libraryaswell as creates a survey for rating the document uploaded. Toauthenticatethe users i have a Form Digest control on the WebPart.The issue i am facing is that default contributors do not have rights tocreate Surveys. What I would like to do is, for the small period thatthesurvey is created, to switch credentials to a user on the SPS 2003 boxthathas rights only to create lists, then create the list, and end.Any ideas on how i can achieve this "switching credentials"
What about hooking into the Doc Lib events and having the workflow runas user that has the correct privileges? Every time a new doc is loaded-> create a survey.
You could also add permissions to the user on the fly. Add the ability tocreate surveys and then once the survey is completed remove that ability fromthe user. The only reason I wouldn't go with Darrin's idea is because theSurvey would be created under a seperate account and then the original poster ofthe document wouldn't have full control of the survey unless you specificallyadd them. I do however agree with the idea of an event sink.
Good point. When you say that you would add permission and remove whencompleted are you meaning after survey is created or when it is no longactive as a survey?
I would just give them permission to create the survey and once they have donethat remove the permission. Once the survey is created they will have rights toreview it and shouldn't need any additional rights.
Use...[DllImport("advapi32.dll", SetLastError=true)]static extern int LogonUser(String UserName, String Domain, StringPassword, int LogonType, int LogonProvider, ref IntPtr Token);