如何在 Sharepoint 列表中管理基于列的访问控制? [英] How to manage column based access control in Sharepoint lists?
问题描述
我正在制作基于 Sharepoint 的问题跟踪门户.用户应该能够添加条目,但在条目本身中,我希望一列仅对特定的用户组(管理员)可见.有没有办法设置基于列的访问控制?
I'm making issue tracking portal based on Sharepoint. Users should be able to add entries, but in the entry itself I want one column to only be visible to a specific group of users (Administrators). Is there a way to set column based access control?
推荐答案
据我所知,在标准平台中是不可用的.另一方面,您可以做的是手工制作自己的 fieldcontrol
As far as I know that is not available in the standard platform. What you can do on the other hand is to handcraft your own fieldcontrol
所以在自定义 fieldtypes.xml 中
So in custom fieldtypes.xml
<FieldTypes>
<FieldType>
<Field Name="TypeName">MyInteger</Field>
<Field Name="ParentType">Integer</Field>
...
<Field Name="FieldTypeClass">xxx</Field>
</FieldType>
在 sitecolumns.xml 中
and in sitecolumns.xml
<Field ID="xxx"
Name="xxx"
DisplayName="xxx
Description="xxx"
Group="xxx
Type="MyInteger"
DisplaceOnUpgrade="TRUE"
/>
并在您的字段控件中
public class MyInteger: SPFieldNumber
{
public MyInteger(SPFieldCollection fields, string fieldName)
: base(fields, fieldName)
{
}
public MyInteger(SPFieldCollection fields, string typeName, string displayName)
: base(fields, typeName, displayName)
{
}
public override BaseFieldControl FieldRenderingControl
{
[SharePointPermission(SecurityAction.LinkDemand, ObjectModel = true)]
get
{
Microsoft.SharePoint.WebControls.BaseFieldControl ctl =
new MyIntegerControl();
ctl.FieldName = InternalName;
return ctl;
}
}
}
在 MyIntegerControl 中你可以做任何你想做的事情(很多覆盖),但一个例子是:
and in the MyIntegerControl you can do whatever you want (lots of overrides), but an example is:
protected override void CreateChildControls()
{
base.CreateChildControls();
if (this.ControlMode == SPControlMode.New ||
this.ControlMode == SPControlMode.Display)
{
// check that use is admin and display value
}
}
这篇关于如何在 Sharepoint 列表中管理基于列的访问控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!