private IAccessControlEditorDialogProvider ProviderFromResourceType(System.Security.AccessControl.ResourceType resType) { IAccessControlEditorDialogProvider prov = null; switch (resType) { case System.Security.AccessControl.ResourceType.FileObject: prov = new FileProvider(); break; case System.Security.AccessControl.ResourceType.KernelObject: prov = new KernelProvider(); break; case System.Security.AccessControl.ResourceType.RegistryKey: prov = new RegistryProvider(); break; case TaskResourceType: prov = new TaskProvider(); break; default: prov = new GenericProvider(); break; } return(prov); }
static extern UInt32 GetInheritanceSource( [MarshalAs(UnmanagedType.LPTStr)] string pObjectName, System.Security.AccessControl.ResourceType ObjectType, SECURITY_INFORMATION SecurityInfo, [MarshalAs(UnmanagedType.Bool)] bool Container, IntPtr pObjectClassGuids, UInt32 GuidCount, byte[] pAcl, IntPtr pfnArray, ref GENERIC_MAPPING pGenericMapping, IntPtr pInheritArray );
/// <summary>Initializes the dialog with a known resource type.</summary> /// <param name="displayName">The display name.</param> /// <param name="fullName">The full name.</param> /// <param name="isContainer">if set to <c>true</c> [is container].</param> /// <param name="resourceType">Type of the resource.</param> /// <param name="sd">The raw security descriptor.</param> /// <param name="targetServer">The target server.</param> public void Initialize(string displayName, string fullName, bool isContainer, System.Security.AccessControl.ResourceType resourceType, byte[] sd, string targetServer = null) { Initialize(displayName, fullName, isContainer, ProviderFromResourceType(resourceType), sd, targetServer); ResourceType = resourceType; }
/// <summary>Initializes the dialog with the specified known object.</summary> /// <param name="fullObjectName">Full name of the object.</param> /// <param name="serverName">Name of the server. This value can be <c>null</c>.</param> /// <param name="resourceType">Type of the object resource.</param> /// <exception cref="System.ArgumentException"> /// Unable to create an object from supplied arguments. /// </exception> public void Initialize(string fullObjectName, string serverName, System.Security.AccessControl.ResourceType resourceType) { Initialize(SecuredObject.GetKnownObject(resourceType, fullObjectName, serverName)); }
/// <summary>Initializes a new instance of the <see cref="ObjectSecurity{T}"/> class.</summary> /// <param name="isContainer"> /// <see langword="true"/> if the new <see cref="T:System.Security.AccessControl.NativeObjectSecurity"/> object is a container object. /// </param> /// <param name="resourceType"> /// The type of securable object with which the new <see cref="T:System.Security.AccessControl.NativeObjectSecurity"/> object is associated. /// </param> /// <param name="safeHandle">A handle.</param> /// <param name="includeSections"> /// One of the <see cref="T:System.Security.AccessControl.AccessControlSections"/> enumeration values that specifies the sections of /// the security descriptor (access rules, audit rules, owner, primary group) of the securable object to include in this /// <see cref="T:System.Security.AccessControl.NativeObjectSecurity"/> object. /// </param> /// <param name="exceptionFromErrorCode">A delegate implemented by integrators that provides custom exceptions.</param> /// <param name="exceptionContext">An object that contains contextual information about the source or destination of the exception.</param> protected ObjectSecurity(bool isContainer, ResourceType resourceType, SafeHandle safeHandle, AccessControlSections includeSections, ExceptionFromErrorCode exceptionFromErrorCode, object exceptionContext) : base(isContainer, resourceType, safeHandle, includeSections, exceptionFromErrorCode, exceptionContext) { }
/// <summary>Initializes a new instance of the <see cref="ObjectSecurity{T}"/> class.</summary> /// <param name="isContainer"> /// <see langword="true"/> if the new <see cref="T:System.Security.AccessControl.NativeObjectSecurity"/> object is a container object. /// </param> /// <param name="resourceType"> /// The type of securable object with which the new <see cref="T:System.Security.AccessControl.NativeObjectSecurity"/> object is associated. /// </param> /// <param name="safeHandle">A handle.</param> /// <param name="includeSections"> /// One of the <see cref="T:System.Security.AccessControl.AccessControlSections"/> enumeration values that specifies the sections of /// the security descriptor (access rules, audit rules, owner, primary group) of the securable object to include in this /// <see cref="T:System.Security.AccessControl.NativeObjectSecurity"/> object. /// </param> protected ObjectSecurity(bool isContainer, ResourceType resourceType, SafeHandle safeHandle, AccessControlSections includeSections) : base(isContainer, resourceType, safeHandle, includeSections, null, null) { }
/// <summary>Initializes a new instance of the <see cref="ObjectSecurity{T}"/> class.</summary> /// <param name="isContainer"> /// <see langword="true"/> if the new <see cref="T:System.Security.AccessControl.NativObjectSecurity"/> object is a container object. /// </param> /// <param name="resourceType"> /// The type of securable object with which the new <see cref="T:System.Security.AccessControl.NativeObjectSecurity"/> object is associated. /// </param> /// <param name="name"> /// The name of the securable object with which the new <see cref="T:System.Security.AccessControl.NativeObjectSecurity"/> object is associated. /// </param> /// <param name="includeSections"> /// One of the <see cref="T:System.Security.AccessControl.AccessControlSections"/> enumeration values that specifies the sections of /// the security descriptor (access rules, audit rules, owner, primary group) of the securable object to include in this /// <see cref="T:System.Security.AccessControl.NativeObjectSecurity"/> object. /// </param> protected ObjectSecurity(bool isContainer, ResourceType resourceType, string name, AccessControlSections includeSections) : base(isContainer, resourceType, name, includeSections, null, null) { }
/// <summary>Initializes a new instance of the <see cref="ObjectSecurity{T}"/> class.</summary> /// <param name="isContainer"> /// <see langword="true"/> if the new <see cref="T:System.Security.AccessControl.NativeObjectSecurity"/> object is a container object. /// </param> /// <param name="resourceType"> /// The type of securable object with which the new <see cref="T:System.Security.AccessControl.NativeObjectSecurity"/> object is associated. /// </param> protected ObjectSecurity(bool isContainer, ResourceType resourceType) : base(isContainer, resourceType, null, null) { }