Adhered to linting rules for authorization policy handlers, requirements and tests.
This commit is contained in:
@@ -1,19 +1,20 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
// Copyright (c) Umbraco.
|
||||
// See LICENSE for more details.
|
||||
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
|
||||
namespace Umbraco.Web.BackOffice.Authorization
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// An authorization requirement for <see cref="ContentPermissionsQueryStringHandler"/>
|
||||
/// </summary>
|
||||
public class ContentPermissionsQueryStringRequirement : IAuthorizationRequirement
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Create an authorization requirement for a specific node id
|
||||
/// Initializes a new instance of the <see cref="ContentPermissionsQueryStringRequirement"/> class for a specific node id.
|
||||
/// </summary>
|
||||
/// <param name="nodeId"></param>
|
||||
/// <param name="permissionToCheck"></param>
|
||||
/// <param name="nodeId">The node Id.</param>
|
||||
/// <param name="permissionToCheck">The permission to authorize the current user against.</param>
|
||||
public ContentPermissionsQueryStringRequirement(int nodeId, char permissionToCheck)
|
||||
{
|
||||
NodeId = nodeId;
|
||||
@@ -21,18 +22,30 @@ namespace Umbraco.Web.BackOffice.Authorization
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an authorization requirement for a node id based on a query string parameter
|
||||
/// Initializes a new instance of the <see cref="ContentPermissionsQueryStringRequirement"/> class for a
|
||||
/// node id based on a query string parameter.
|
||||
/// </summary>
|
||||
/// <param name="paramName"></param>
|
||||
/// <param name="permissionToCheck"></param>
|
||||
/// <param name="paramName">The querystring parameter name.</param>
|
||||
/// <param name="permissionToCheck">The permission to authorize the current user against.</param>
|
||||
public ContentPermissionsQueryStringRequirement(char permissionToCheck, string paramName = "id")
|
||||
{
|
||||
QueryStringName = paramName;
|
||||
PermissionToCheck = permissionToCheck;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the specific node Id.
|
||||
/// </summary>
|
||||
public int? NodeId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the querystring parameter name.
|
||||
/// </summary>
|
||||
public string QueryStringName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the permission to authorize the current user against.
|
||||
/// </summary>
|
||||
public char PermissionToCheck { get; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user