views:

75

answers:

2

I am developing a sharepoint 2010 visual webpart that will show some sort of ajax content.

I have a property on the webpart for the refresh rate, but I want this property to be set only by an Administrator (or any specific group).

What is the best way to achieve this?

Thank you.

+3  A: 

In our organization, everyone by default is granted "Read" permission to our SharePoint sites through an "All Employees" Active Directory group. This allows users to browse the pages, but not edit them; and if you can't edit a page, you can't edit any web parts on the page.

Those who should have elevated privileges are added to other AD groups (you could use SharePoint groups too), and those groups are granted appropriate permissions.

CBono
+2  A: 

You could create a custom Toolpart. Take a look at this example for a tutorial on how to create one.

Overall, your general steps will be:

  1. Create your custom Toolpart class inheriting from Microsoft.SharePoint.WebPartPages.ToolPart
  2. In your custom Toolpart, override CreateChildControls, write the code to display your textbox as long as the current user has permission (based on whatever rules you choose, ex: SharePoint group).
  3. In your webpart, override GetToolParts and add your custom ToolPart so that it shows up in the right hand side
Kit Menke