Merge pull request #5054 from kjac/fix-content-empty-trash-audit-user

V7: Log correct user ID when emptying the content recycle bin
This commit is contained in:
Sebastiaan Janssen
2019-04-17 15:58:43 +02:00
committed by GitHub
3 changed files with 1245 additions and 1229 deletions

View File

@@ -1741,7 +1741,15 @@ namespace Umbraco.Core.Services
/// <summary>
/// Empties the Recycle Bin by deleting all <see cref="IContent"/> that resides in the bin
/// </summary>
public void EmptyRecycleBin()
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Use EmptyRecycleBin with explicit indication of user ID instead")]
public void EmptyRecycleBin() => EmptyRecycleBin(0);
/// <summary>
/// Empties the Recycle Bin by deleting all <see cref="IContent"/> that resides in the bin
/// </summary>
/// <param name="userId">Optional Id of the User emptying the Recycle Bin</param>
public void EmptyRecycleBin(int userId = 0)
{
using (new WriteLock(Locker))
{
@@ -1771,7 +1779,7 @@ namespace Umbraco.Core.Services
recycleBinEventArgs.RecycleBinEmptiedSuccessfully = success;
uow.Events.Dispatch(EmptiedRecycleBin, this, recycleBinEventArgs);
Audit(uow, AuditType.Delete, "Empty Content Recycle Bin performed by user", 0, Constants.System.RecycleBinContent);
Audit(uow, AuditType.Delete, "Empty Content Recycle Bin performed by user", userId, Constants.System.RecycleBinContent);
uow.Commit();
}
}

View File

@@ -440,8 +440,16 @@ namespace Umbraco.Core.Services
/// <summary>
/// Empties the Recycle Bin by deleting all <see cref="IContent"/> that resides in the bin
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Use EmptyRecycleBin with explicit indication of user ID instead")]
void EmptyRecycleBin();
/// <summary>
/// Empties the Recycle Bin by deleting all <see cref="IContent"/> that resides in the bin
/// </summary>
/// <param name="userId">Optional Id of the User emptying the Recycle Bin</param>
void EmptyRecycleBin(int userId = 0);
/// <summary>
/// Rollback an <see cref="IContent"/> object to a previous version.
/// This will create a new version, which is a copy of all the old data.

File diff suppressed because it is too large Load Diff