: IndividuallySecurableMetadataObject.SetAccessControlList (Método) (Microsoft.Office.Server.ApplicationRegistry.Administration)
Sets the access control list for an individually securable metadata object.
Espacio de nombres:
Ensamblado: Microsoft.SharePoint.Portal (in microsoft.sharepoint.portal.dll)
Sintaxis
'Declaración
Public Overridable Sub SetAccessControlList ( _
acl As IAccessControlList _
)
'Uso
Dim instance As IndividuallySecurableMetadataObject
Dim acl As IAccessControlList
instance.SetAccessControlList(acl)
public virtual void SetAccessControlList (
IAccessControlList acl
)
Parámetros
- acl
The IAccessControlList object to set.
Ejemplo
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)
{
}
}
Vea también
Referencia
IndividuallySecurableMetadataObject (Clase)
IndividuallySecurableMetadataObject (Miembros)
Microsoft.Office.Server.ApplicationRegistry.Administration (Espacio de nombres)