AccessControlledMetadataObject.GetAccessControlList 方法 (Microsoft.Office.Server.ApplicationRegistry.Administration)
A virtual method that is designed to return the list of access control entries (ACEs) associated with the metadata object registered in the Business Data Catalog.
命名空间: Microsoft.Office.Server.ApplicationRegistry.Administration
程序集: Microsoft.SharePoint.Portal (在 microsoft.sharepoint.portal.dll 中)
语法
声明
Public Overridable Function GetAccessControlList As IAccessControlList
用法
Dim instance As AccessControlledMetadataObject
Dim returnValue As IAccessControlList
returnValue = instance.GetAccessControlList
public virtual IAccessControlList GetAccessControlList ()
返回值
A list of ACEs associated with the metadata object.
备注
A metadata object can own its own ACL or borrow it from the nearest parent object that owns its own ACL. (An object that owns its own ACL is termed individually securable).
This method can be overridden by any class that inherits it.
示例
The following code example shows how to retrieve the ACL for an LobSystem instance that is registered in the Business Data Catalog.
Prerequisites
Ensure a Shared Service Provider is already created.
Create an LobSystem instance and set connection parameters as shown in 如何:使用管理对象模型创建 LobSystem.
Create the ProductModel entity as shown in 如何:使用管理对象模型创建实体.
Create a Finder method as shown in 如何:使用管理对象模型创建方法和筛选器.
Replace the constant value EnterYourSSPNameHere in the code with the name of your Shared Resource Provider.
Project References
Add the following Project References in your console application code project before running this sample:
Microsoft.SharePoint
Microsoft.SharePoint.Portal
Microsoft.Office.Server
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Server.ApplicationRegistry.Administration;
using Microsoft.Office.Server.ApplicationRegistry.Infrastructure;
using WSSAdmin = Microsoft.SharePoint.Administration;
using OSSAdmin = Microsoft.Office.Server.Administration;
namespace Microsoft.SDK.SharePointServer.Samples
{
class GetStartedAndCreateSystem
{
const string yourSSPName ="EnterYourSSPNameHere";
static void Main(string[] args)
{
SetupBDC();
GetAccessControlList();
Console.WriteLine("Press any key to exit...");
Console.Read();
}
static void SetupBDC()
{
SqlSessionProvider.Instance().SetSharedResourceProviderToUse(yourSSPName);
}
public static void GetAccessControlList()
{
LobSystemInstance mySysInstance = null;
LobSystemInstanceCollection sysInsCollection = ApplicationRegistry.Instance.GetLobSystemInstancesLikeName("AdventureWorksSampleFromCode");
foreach (LobSystemInstance sysInstance in sysInsCollection)
{
if (sysInstance.Name == "AdventureWorksSampleFromCode")
{
mySysInstance = sysInstance;
break;
}
}
LobSystem ls = mySysInstance.LobSystem;
IAccessControlList acl = ls.GetAccessControlList();
foreach (IAccessControlEntry ace in acl)
{
Console.WriteLine(ace.IdentityName);
Console.WriteLine(ace.Rights);
}
}
}
}
另请参阅
参考
AccessControlledMetadataObject 类
AccessControlledMetadataObject 成员
Microsoft.Office.Server.ApplicationRegistry.Administration 命名空间