Método IndividuallySecurableMetadataObject.SetAccessControlList
Define o lista de controle de acesso para um objeto que possa ser assegurado individualmente metadados.
Espaço para nome Microsoft.Office.Server.ApplicationRegistry.Administration
Conjunto de Módulos (Assembly) Microsoft.SharePoint.Portal (em microsoft.sharepoint.portal.dll)
A sintaxe
Public Overridable Sub SetAccessControlList ( _
acl As IAccessControlList _
)
Dim instance As IndividuallySecurableMetadataObject
Dim acl As IAccessControlList
instance.SetAccessControlList(acl)
public virtual void SetAccessControlList (
IAccessControlList acl
)
Parâmetros
- acl
O IAccessControlList IAccessControlList objeto para definir.
Exemplo
public static void SetAccessControlListForCurrentUser()
{
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 = new BdcAccessControlList();
String currentIdentity = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
acl.Add(new IndividualAccessControlEntry(currentIdentity, BdcRights.SetPermissions | BdcRights.Execute | BdcRights.Edit | BdcRights.UseInBusinessDataInLists | BdcRights.UseInWebParts));
try
{
ls.SetAccessControlList(acl);
}
catch (AccessDeniedException)
{
}
}
public static void SetAccessControlList()
{
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();
String currentIdentity = "Redmond\\umas";
acl.Add(new IndividualAccessControlEntry(currentIdentity, BdcRights.SetPermissions | BdcRights.Execute | BdcRights.Edit | BdcRights.UseInBusinessDataInLists | BdcRights.UseInWebParts));
try
{
ls.SetAccessControlList(acl);
}
catch (AccessDeniedException)
{
}
}
Consulte também
Referência
IndividuallySecurableMetadataObject De classe
IndividuallySecurableMetadataObject Membros
Microsoft.Office.Server.ApplicationRegistry.Administration De espaço para nome