如何使 Web 部件属性只能由管理员自定义
我正在开发一个 sharepoint 2010 可视化 web 部件,它将显示某种 ajax 内容。
我在 Web 部件上有一个用于刷新率的属性,但我希望该属性仅由管理员(或任何特定组)设置。
实现这一目标的最佳方法是什么?
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我们的组织中,默认情况下,每个人都通过“所有员工”Active Directory 组被授予对我们的 SharePoint 网站的“读取”权限。这允许用户浏览页面,但不能编辑它们;如果您无法编辑页面,则无法编辑该页面上的任何 Web 部件。
那些应该具有提升权限的用户将被添加到其他 AD 组(您也可以使用 SharePoint 组),并且这些组将被授予适当的权限。
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.
您可以创建自定义工具部件。查看此示例以获取教程关于如何创建一个。
总的来说,您的一般步骤如下:
Microsoft.SharePoint.WebPartPages.ToolPart
的自定义 Toolpart 类CreateChildControls
,编写代码以显示您的只要当前用户具有权限(基于您选择的任何规则,例如:SharePoint 组)。GetToolParts
并添加您的自定义 ToolPart,以便它显示在右侧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:
Microsoft.SharePoint.WebPartPages.ToolPart
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).GetToolParts
and add your custom ToolPart so that it shows up in the right hand side