SharePoint WebPart Permissions


SharePoint WebPart Permissions



Hi I am using the SharePoint namespace for a webpart and I encounter some permission errors when I try to use the System account. Is there a way I can use a defined user instead of the system account?

Right now I have:

SPUserToken sysToken = SPContext.Current.Site.SystemAccount.UserToken; using (SPSite site = new SPSite(_SPSite, sysToken)) 

I want to be able to use an account on the domain instead of the System account, thanks for any advice.




How to restrict VOB read access in ClearCase (Windows Server)?

1:



AntiSpam measures on websites
You may need to use RunWithElevatedPermissions to get access to the System account to work, as per the following blog post:.
How can one site's security keep another site from loading?
http://solutionizing.net/2009/01/06/elegant-spsite-elevation/.
How do i test my antispam code against bots?


Feed access control


How safe is my SSL connection even with a SSL certificate?

2:



how secure is tomcat
You can use the SPUserCollection .
How do I pre-determine the length of the resultant cipher text produced in an encryption operation?
SPContext.Current.Site.RootWeb.AllUsers 
to get all of the users on the site, and get the SPUser from there.

Once you have the SPUser you can get the UserToken..


3:


What are you trying to do? If you don't use a token, the web will be opened with the same permissions as the current user.
/* runs as user requesting the web part */ SPSite site = SPContext.Current.Web.site 
or you can wrap it in the RunWithElevatedPrivileges delegate.
/* runs with admin privileges */          SPSecurity.RunWithElevatedPrivileges(    delegate()    {       using (SPSite site = new SPSite(SPContext.Current.Web.Site.Url))       {         //do stuff       }    } ); 



80 out of 100 based on 50 user ratings 350 reviews