不为具有“贡献”权限级别的用户显示可个性化 Web 部件自定义属性
我已经为 SharePoint 2010 创建了 Web 部件,其中包含带有 PersonalizationScope.User
的简单自定义属性。 从 System.Web.UI.WebControls.WebParts.WebPart
继承的 Web 部件
private int _mainBodyBorderWidth = 0;
[Personalizable(PersonalizationScope.User),
WebBrowsable(true),
WebDisplayName("Main Body Border Width"),
WebDescription("Set main body border width"),
Category("Style")]
public int MainBodyBorderWidth
{
get
{
return _mainBodyBorderWidth;
}
set
{
_mainBodyBorderWidth = value;
}
}
当站点管理员或具有添加和自定义页面权限的用户单击“个性化页面”< /strong> 并且“编辑我的 Web 部件” 此属性显示在 Web 部件工具窗格中。但是,具有标准权限级别“贡献”的用户无法看到此属性。
I've create the Web Part for SharePoint 2010, which contains simple custom property with PersonalizationScope.User
.
Web part inherited from the System.Web.UI.WebControls.WebParts.WebPart
private int _mainBodyBorderWidth = 0;
[Personalizable(PersonalizationScope.User),
WebBrowsable(true),
WebDisplayName("Main Body Border Width"),
WebDescription("Set main body border width"),
Category("Style")]
public int MainBodyBorderWidth
{
get
{
return _mainBodyBorderWidth;
}
set
{
_mainBodyBorderWidth = value;
}
}
When Site Administrator or users with permission Add and Customize Pages click "Personalize Page" and than "Edit My Web Part" this property is displayed in the web part tool pane. However users with standard permission level "Contribute" can't see this property.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
阅读这篇文章和一些调查后,我得到了关于
的以下结果Web 部件的 SafeContol
标记。对于未经添加和自定义页面权限的用户可以添加/删除或修改的 Web 部件,必须应用以下注意事项。TypeName
属性应使用特定类型名称而不是通配符。Safe
设置为 “True”SafeAgainstScript
也设置为 “True”SafeControl 标记将类似于以下内容:
但是,VS 2010 默认情况下为
TypeName
属性生成通配符 "*",并且 Web 部件 项的SafeAgainstScript
属性值为“False”。因此,您需要更改Web 部件项属性安全控制条目集合条目中的特定类型名称和“SafeAgainstScript”属性值。After reading this article and some investigation I get following results about
SafeContol
tag for the web part. The following considerations must be applied for the web part which user without permission Add and Customize Pages can add/remove or modify.TypeName
attribute of the tag should use particular type name instead wildcard.Safe
set to "True"SafeAgainstScript
also set to "True"And SafeControl tag will look similar to this:
<SafeControl Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebPartPages" TypeName="ListViewWebPart" Safe="True" SafeAgainstScript="True" />
However VS 2010 by default generate wildcard "*" for the
TypeName
attribute, and "False" value for theSafeAgainstScript
attribute of the Web Part item. So you need change in the Web Part item Properties Safe Control Entries collection entry with particular type name and "SafeAgainstScript" property right value.