/// <summary> /// Audits a successful file system operation that involves a source and a target resource (move / copy). /// </summary> public static void AuditResourceOperation <T>(this IAuditor auditor, FileSystemTask context, AuditEvent eventId, IVirtualResourceItem <T> sourceFolder, IVirtualResourceItem <T> targetFolder) where T : VirtualResourceInfo { if (!auditor.IsInfoEnabledFor(context)) { return; } string msg = String.Format("Successfully performed file system operation '{0}'.\n\nSource:\n{1}\n\nTarget:\n{2}", context, sourceFolder.CreateResourceInfoString(), targetFolder.CreateResourceInfoString()); auditor.Audit(AuditLevel.Info, context, eventId, msg); }
/// <summary> /// Audits a successful file system operation for a given resource. /// </summary> public static void AuditResourceOperation <T>(this IAuditor auditor, FileSystemTask context, AuditEvent eventId, IVirtualResourceItem <T> resource) where T : VirtualResourceInfo { if (!auditor.IsInfoEnabledFor(context)) { return; } string msg = String.Format("Successfully performed file system operation '{0}' for resource [{1}].\n\n{2}", context, resource.ResourceInfo.Name, resource.CreateResourceInfoString()); auditor.Audit(AuditLevel.Info, context, eventId, msg); }
/// <summary> /// Audits a file system operation that was blocked as a warning. /// </summary> public static void AuditDeniedOperation <T>(this IAuditor auditor, FileSystemTask context, AuditEvent eventId, IVirtualResourceItem <T> resource, string message) where T : VirtualResourceInfo { if (!auditor.IsWarnEnabledFor(context)) { return; } string msg = String.Format("Blocked operation '{0}' due to event '{1}'.", context, eventId); if (!String.IsNullOrEmpty(message)) { msg = String.Format("{0}\n{1}", msg, message); } msg = String.Format("{0}\n\n{1}", msg, resource.CreateResourceInfoString()); auditor.Audit(AuditLevel.Warning, context, eventId, msg); }