我正在基于Sharepoint制作问题跟踪门户.用户应该能够添加条目,但在条目本身中我希望一列只对特定用户组(管理员)可见.有没有办法设置基于列的访问控制?
据我所知,标准平台不具备此功能.另一方面,你可以做的是手工制作你自己的现场控制
所以在自定义fieldtypes.xml中
<FieldTypes>
<FieldType>
<Field Name="TypeName">MyInteger</Field>
<Field Name="ParentType">Integer</Field>
...
<Field Name="FieldTypeClass">xxx</Field>
</FieldType>
Run Code Online (Sandbox Code Playgroud)
并在sitecolumns.xml中
<Field ID="xxx"
Name="xxx"
DisplayName="xxx
Description="xxx"
Group="xxx
Type="MyInteger"
DisplaceOnUpgrade="TRUE"
/>
Run Code Online (Sandbox Code Playgroud)
并在你的现场控制
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;
}
}
}
Run Code Online (Sandbox Code Playgroud)
并且在MyIntegerControl中你可以做任何你想做的事情(很多覆盖),但一个例子是:
protected override void CreateChildControls()
{
base.CreateChildControls();
if (this.ControlMode == SPControlMode.New ||
this.ControlMode == SPControlMode.Display)
{
// check that use is admin and display value
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6158 次 |
| 最近记录: |