Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #3997 from NuGet/dev
[ReleasePrep][2017.05.19]RI of dev into master
- Loading branch information
Showing
91 changed files
with
3,750 additions
and
1,081 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/NuGetGallery.Core/Auditing/AuditedEntities/AuditedUserSecurityPolicy.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace NuGetGallery.Auditing.AuditedEntities | ||
{ | ||
/// <summary> | ||
/// Auditing details for UserSecurityPolicy entity. | ||
/// </summary> | ||
public class AuditedUserSecurityPolicy | ||
{ | ||
public string Name { get; } | ||
public string Subscription { get; } | ||
public string Value { get; } | ||
|
||
public AuditedUserSecurityPolicy(UserSecurityPolicy policy) | ||
{ | ||
Name = policy.Name; | ||
Subscription = policy.Subscription; | ||
Value = policy.Value; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ public enum AuditedPackageAction | |
Unlist, | ||
Edit, | ||
UndoEdit, | ||
|
||
|
||
Verify | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/NuGetGallery.Core/Auditing/AuditedSecurityPolicyAction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
namespace NuGetGallery.Auditing | ||
{ | ||
public enum AuditedSecurityPolicyAction | ||
{ | ||
Create, | ||
Verify | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/NuGetGallery.Core/Auditing/UserSecurityPolicyAuditRecord.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using NuGetGallery.Auditing.AuditedEntities; | ||
|
||
namespace NuGetGallery.Auditing | ||
{ | ||
/// <summary> | ||
/// Audit record for user security policy evaluations. | ||
/// </summary> | ||
public class UserSecurityPolicyAuditRecord : AuditRecord<AuditedSecurityPolicyAction> | ||
{ | ||
public string Username { get; } | ||
|
||
public AuditedUserSecurityPolicy[] AffectedPolicies { get; } | ||
|
||
public bool Success { get; set; } | ||
|
||
public string ErrorMessage { get; } | ||
|
||
public UserSecurityPolicyAuditRecord(string username, | ||
AuditedSecurityPolicyAction action, | ||
IEnumerable<UserSecurityPolicy> affectedPolicies, | ||
bool success, string errorMessage = null) | ||
:base(action) | ||
{ | ||
if (string.IsNullOrEmpty(username)) | ||
{ | ||
throw new ArgumentNullException(nameof(username)); | ||
} | ||
if (affectedPolicies == null || affectedPolicies.Count() == 0) | ||
{ | ||
throw new ArgumentException(nameof(affectedPolicies)); | ||
} | ||
|
||
Username = username; | ||
AffectedPolicies = affectedPolicies.Select(p => new AuditedUserSecurityPolicy(p)).ToArray(); | ||
Success = success; | ||
ErrorMessage = errorMessage; | ||
} | ||
|
||
public override string GetPath() | ||
{ | ||
return Username.ToLowerInvariant(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.