// Copyright (c) Umbraco.
// See LICENSE for more details.
using Microsoft.AspNetCore.Authorization;
namespace Umbraco.Cms.Web.BackOffice.Authorization
{
///
/// An authorization requirement for
///
public class ContentPermissionsQueryStringRequirement : IAuthorizationRequirement
{
///
/// Initializes a new instance of the class for a specific node id.
///
/// The node Id.
/// The permission to authorize the current user against.
public ContentPermissionsQueryStringRequirement(int nodeId, char permissionToCheck)
{
NodeId = nodeId;
PermissionToCheck = permissionToCheck;
}
///
/// Initializes a new instance of the class for a
/// node id based on a query string parameter.
///
/// The querystring parameter name.
/// The permission to authorize the current user against.
public ContentPermissionsQueryStringRequirement(char permissionToCheck, string paramName = "id")
{
QueryStringName = paramName;
PermissionToCheck = permissionToCheck;
}
///
/// Gets the specific node Id.
///
public int? NodeId { get; }
///
/// Gets the querystring parameter name.
///
public string QueryStringName { get; }
///
/// Gets the permission to authorize the current user against.
///
public char PermissionToCheck { get; }
}
}