aboutsummaryrefslogtreecommitdiff
path: root/plugins/VNLib.Plugins.Essentials.Content.Routing/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/VNLib.Plugins.Essentials.Content.Routing/src')
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/Route.cs10
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/RoutingContext.cs2
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/XmlRouteStore.cs6
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/RouteComparer.cs2
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/Router.cs18
-rw-r--r--plugins/VNLib.Plugins.Essentials.Content.Routing/src/sample.routes.xml4
6 files changed, 21 insertions, 21 deletions
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/Route.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/Route.cs
index acceb0c..789d72f 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/Route.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/Route.cs
@@ -46,15 +46,15 @@ namespace VNLib.Plugins.Essentials.Content.Routing.Model
public string MatchPath { get; set; }
- [Column("Privilage")]
- public long _privilage
+ [Column("Privilege")]
+ public long _privilege
{
- get => (long)Privilage;
- set => Privilage = (ulong)value;
+ get => (long)Privilege;
+ set => Privilege = (ulong)value;
}
[NotMapped]
- public ulong Privilage { get; set; }
+ public ulong Privilege { get; set; }
public string? Alternate { get; set; } = string.Empty;
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/RoutingContext.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/RoutingContext.cs
index 4edb892..185b2f2 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/RoutingContext.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/RoutingContext.cs
@@ -66,7 +66,7 @@ namespace VNLib.Plugins.Essentials.Content.Routing.Model
.Next()
//Default to read-on
- .WithColumn(r => r.Privilage)
+ .WithColumn(r => r.Privilege)
.WithDefault(Accounts.AccountUtil.READ_MSK)
.AllowNull(false)
.Next()
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/XmlRouteStore.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/XmlRouteStore.cs
index 5420996..2dcc25c 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/XmlRouteStore.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Model/XmlRouteStore.cs
@@ -117,13 +117,13 @@ namespace VNLib.Plugins.Essentials.Content.Routing.Model
}
//read priv level attribute
- string? privAtr = routeEl.Attributes["privilage"]?.Value;
- _ = privAtr ?? throw new XmlException("Missing required attribute 'priv' in route element");
+ string? privAtr = routeEl.Attributes["privilege"]?.Value;
+ _ = privAtr ?? throw new XmlException("Missing required attribute 'privilege' in route element");
//Try to get the priv level enum value
if (ulong.TryParse(privAtr, out ulong priv))
{
- route.Privilage = priv;
+ route.Privilege = priv;
}
else
{
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/RouteComparer.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/RouteComparer.cs
index e214e14..bd9f3b3 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/RouteComparer.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/RouteComparer.cs
@@ -68,7 +68,7 @@ namespace VNLib.Plugins.Essentials.Content.Routing
if (val == 0)
{
//Higher privilage routine is greater than lower privilage
- val = (x.Privilage & LEVEL_MSK) > (y.Privilage & LEVEL_MSK) ? 1 : -1;
+ val = (x.Privilege & LEVEL_MSK) > (y.Privilege & LEVEL_MSK) ? 1 : -1;
}
//If both contain (or are) wildcards, then they are equal
return val;
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Router.cs b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Router.cs
index 3d3a1a6..59a88c1 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Router.cs
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/Router.cs
@@ -63,19 +63,19 @@ namespace VNLib.Plugins.Essentials.Content.Routing
public async ValueTask<FileProcessArgs> RouteAsync(HttpEntity entity)
{
//Default to read-only privilages
- ulong privilage = AccountUtil.READ_MSK;
+ ulong privileges = AccountUtil.READ_MSK;
//Only select privilages for logged-in users, this is a medium security check since we may not have all data available
if (entity.Session.IsSet && entity.IsClientAuthorized(AuthorzationCheckLevel.Medium))
{
- privilage = entity.Session.Privilages;
+ privileges = entity.Session.Privilages;
}
//Get the routing table for the current host
ReadOnlyCollection<Route> routes = await RouteTable.GetOrAdd(entity.RequestedRoot, LoadRoutesAsync);
//Find the proper routine for the connection
- Route? selected = SelectBestRoute(routes, entity.RequestedRoot.Hostname, entity.Server.Path, privilage);
+ Route? selected = SelectBestRoute(routes, entity.RequestedRoot.Hostname, entity.Server.Path, privileges);
//Get the arguments for the selected route, if not found allow the connection to continue
return selected?.GetArgs(entity) ?? FileProcessArgs.Continue;
@@ -113,9 +113,9 @@ namespace VNLib.Plugins.Essentials.Content.Routing
/// <param name="routes">The routes collection to read</param>
/// <param name="hostname">The connection hostname to filter routes for</param>
/// <param name="path">The connection url path to filter routes for</param>
- /// <param name="privilages">The calculated privialges of the connection</param>
+ /// <param name="privileges">The calculated privialges of the connection</param>
/// <returns>The best route match for the connection if one is found, null otherwise</returns>
- private static Route? SelectBestRoute(ReadOnlyCollection<Route> routes, string hostname, string path, ulong privilages)
+ private static Route? SelectBestRoute(ReadOnlyCollection<Route> routes, string hostname, string path, ulong privileges)
{
//Rent an array to sort routes for the current user
Route[] matchArray = ArrayPool<Route>.Shared.Rent(routes.Count);
@@ -124,7 +124,7 @@ namespace VNLib.Plugins.Essentials.Content.Routing
//Search for routes that match
for (int i = 0; i < routes.Count; i++)
{
- if (FastMatch(routes[i], hostname, path, privilages))
+ if (FastMatch(routes[i], hostname, path, privileges))
{
//Add to sort array
matchArray[count++] = routes[i];
@@ -176,9 +176,9 @@ namespace VNLib.Plugins.Essentials.Content.Routing
/// <param name="route">The route to test against</param>
/// <param name="hostname">The hostname to test</param>
/// <param name="path">The resource path to test</param>
- /// <param name="privilages">The privialge level to search for</param>
+ /// <param name="privileges">The privialge level to search for</param>
/// <returns>True if the route can be matched to the resource and the privialge level</returns>
- private static bool FastMatch(Route route, ReadOnlySpan<char> hostname, ReadOnlySpan<char> path, ulong privilages)
+ private static bool FastMatch(Route route, ReadOnlySpan<char> hostname, ReadOnlySpan<char> path, ulong privileges)
{
//Get span of hostname to stop string heap allocations during comparisons
ReadOnlySpan<char> routineHost = route.Hostname;
@@ -209,7 +209,7 @@ namespace VNLib.Plugins.Essentials.Content.Routing
}
//Test if the level and group privilages match for the current routine
- return (privilages & AccountUtil.LEVEL_MSK) >= (route.Privilage & AccountUtil.LEVEL_MSK) && (route.Privilage & AccountUtil.GROUP_MSK) == (privilages & AccountUtil.GROUP_MSK);
+ return (privileges & AccountUtil.LEVEL_MSK) >= (route.Privilege & AccountUtil.LEVEL_MSK) && (route.Privilege & AccountUtil.GROUP_MSK) == (privileges & AccountUtil.GROUP_MSK);
}
}
}
diff --git a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/sample.routes.xml b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/sample.routes.xml
index 3c87aa7..bf7297f 100644
--- a/plugins/VNLib.Plugins.Essentials.Content.Routing/src/sample.routes.xml
+++ b/plugins/VNLib.Plugins.Essentials.Content.Routing/src/sample.routes.xml
@@ -17,7 +17,7 @@
Because this route has a more specific path than the catch all route
it will be processed first
-->
- <route routine="1" privilage="0">
+ <route routine="1" privilege="0">
<!--Wildcard host-->
<hostname>*</hostname>
@@ -27,7 +27,7 @@
</route>
<!--Overwrite all other requests to the index file (catch all) using the ServeOther routine (4)-->
- <route routine="4" privilage="0">
+ <route routine="4" privilege="0">
<!--Wildcard hostname-->
<hostname>*</hostname>