/// <summary> /// Initializes a new instance of the <see cref="ServiceControllerAuditRule"/> class for a user account specified in a /// <see cref="IdentityReference"/> object. /// </summary> /// <param name="identity">The name of the user account.</param> /// <param name="rights"> /// One of the <see cref="ServiceControllerAccessRights"/> values that specifies the type of operation associated with the access rule. /// </param> /// <param name="flags">One of the <see cref="AuditFlags"/> values that specifies when to perform auditing.</param> public ServiceControllerAuditRule(string identity, ServiceControllerAccessRights rights, AuditFlags flags) : this(new NTAccount(identity), ServiceControllerAccessRule.AccessMaskFromRights(rights), false, flags) { }
/// <summary> /// Initializes a new instance of the <see cref="ServiceControllerAuditRule"/> class for a user account specified in a /// <see cref="IdentityReference"/> object. /// </summary> /// <param name="identity">An <see cref="IdentityReference"/> object that encapsulates a reference to a user account.</param> /// <param name="rights"> /// One of the <see cref="ServiceControllerAccessRights"/> values that specifies the type of operation associated with the access rule. /// </param> /// <param name="flags">One of the <see cref="AuditFlags"/> values that specifies when to perform auditing.</param> public ServiceControllerAuditRule(IdentityReference identity, ServiceControllerAccessRights rights, AuditFlags flags) : this(identity, ServiceControllerAccessRule.AccessMaskFromRights(rights), false, flags) { }
/// <summary> /// Initializes a new instance of the <see cref="ServiceControllerAccessRule"/> class with the specified identity, access rights, and /// access control type.. /// </summary> /// <param name="identity">An <see cref="IdentityReference"/> object that encapsulates a reference to a user account.</param> /// <param name="rights"> /// One of the <see cref="ServiceControllerAccessRights"/> values that specifies the type of operation associated with the access rule. /// </param> /// <param name="type">One of the <see cref="AccessControlType"/> values that specifies whether to allow or deny the operation.</param> public ServiceControllerAccessRule(IdentityReference identity, ServiceControllerAccessRights rights, AccessControlType type) : this(identity, AccessMaskFromRights(rights), false, type) { }
internal static int AccessMaskFromRights(ServiceControllerAccessRights rights) => rights >= 0 && rights <= ServiceControllerAccessRights.FullControl ? (int)rights : throw new ArgumentOutOfRangeException(nameof(rights));
/// <summary> /// Initializes a new instance of the <see cref="ServiceControllerAccessRule"/> class with the specified identity, access rights, and /// access control type.. /// </summary> /// <param name="identity">The name of the user account.</param> /// <param name="rights"> /// One of the <see cref="ServiceControllerAccessRights"/> values that specifies the type of operation associated with the access rule. /// </param> /// <param name="type">One of the <see cref="AccessControlType"/> values that specifies whether to allow or deny the operation.</param> public ServiceControllerAccessRule(string identity, ServiceControllerAccessRights rights, AccessControlType type) : this(new NTAccount(identity), AccessMaskFromRights(rights), false, type) { }