16.01.2013 Views

Microsoft Sharepoint Products and Technologies Resource Kit eBook

Microsoft Sharepoint Products and Technologies Resource Kit eBook

Microsoft Sharepoint Products and Technologies Resource Kit eBook

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

1008 Part IX: Maintaining a Server in Windows SharePoint Services<br />

The SharePoint <strong>Products</strong> <strong>and</strong> <strong>Technologies</strong> class libraries use code access security<br />

to protect certain resources <strong>and</strong> operations by specifying the permissions that<br />

they require to run. The members of the SharePoint class libraries dem<strong>and</strong> Share-<br />

PointPermission with the ObjectModel property set to true. You should take note of<br />

this <strong>and</strong> ensure that any assemblies you create that use the WSS object model have<br />

this permission.<br />

Note If you look at the .NET Framework Class Library information, which<br />

can be found on MSDN, you will notice a Requirements section that outlines<br />

the permissions required in order to execute a method.<br />

If the default permission level does not suit your needs, there are several ways<br />

to make sure your code has the required permissions. One option is to consider<br />

installing the assembly in the Global Assembly Cache (GAC) because the code in it,<br />

by default, has Full trust. Installing assemblies in the Global Assembly Cache is not<br />

recommended; it’s best to assign the assembly the lowest level of permissions possible.<br />

Another option is to consider raising the trust level for the virtual server<br />

extended with SharePoint. Yet another option is to create a custom security policy<br />

<strong>and</strong> assign the needed permissions to the specific assembly or set of assemblies.<br />

Note If you want to know more about raising the trust level for assemblies,<br />

you can refer to “<strong>Microsoft</strong> Windows SharePoint Services <strong>and</strong> Code<br />

Access Security” on MSDN.<br />

If your code tries to write data to the WSS database on an HTTP Get, or if the<br />

code needs to enable Web Part to Web Part connections, your code might also need<br />

two other permissions specific to <strong>Microsoft</strong> SharePoint <strong>Products</strong> <strong>and</strong> <strong>Technologies</strong>:<br />

SharePointPermission.UnsafeSaveOnGet <strong>and</strong> WebPartPermission.Connections. If<br />

you want to use the classes <strong>and</strong> the members in the <strong>Microsoft</strong>.SharePoint.Portal.Single-<br />

SignOn namespace, your code will need an additional permission: SingleSignOn-<br />

Permission.Access. Your code might also need one or more of the default .NET<br />

permissions if it tries to perform an action or access a resource that is protected by<br />

the common language runtime.<br />

Changing trust levels for the virtual server is an easy approach to granting or<br />

revoking permissions. Changing the trust level is a global change affecting all assemblies.<br />

There might be situations in which an administrator might want to either grant<br />

more permissions or reduce the number of permissions granted to specific assemblies.<br />

To do this, you must create a custom code group <strong>and</strong> add this to the security<br />

policy file.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!