* Getting new netcore PublicAccessChecker in place * Adds full test coverage for PublicAccessChecker * remove PublicAccessComposer * adjust namespaces, ensure RoleManager works, separate public access controller, reduce content controller * Implements the required methods on IMemberManager, removes old migrated code * Updates routing to be able to re-route, Fixes middleware ordering ensuring endpoints are last, refactors pipeline options, adds public access middleware, ensures public access follows all hops * adds note * adds note * Cleans up ext methods, ensures that members identity is added on both front-end and back ends. updates how UmbracoApplicationBuilder works in that it explicitly starts endpoints at the time of calling. * Changes name to IUmbracoEndpointBuilder * adds note * Fixing tests, fixing error describers so there's 2x one for back office, one for members, fixes TryConvertTo, fixes login redirect * fixing build * Fixes keepalive, fixes PublicAccessMiddleware to not throw, updates startup code to be more clear and removes magic that registers middleware. * adds note * removes unused filter, fixes build * fixes WebPath and tests * Looks up entities in one query * remove usings * Fix test, remove stylesheet * Set status code before we write to response to avoid error * Ensures that users and members are validated when logging in. Shares more code between users and members. * Fixes RepositoryCacheKeys to ensure the keys are normalized * oops didn't mean to commit this * Fix casing issues with caching, stop boxing value types for all cache operations, stop re-creating string keys in DefaultRepositoryCachePolicy * bah, far out this keeps getting recommitted. sorry Co-authored-by: Bjarke Berg <mail@bergmania.dk>
56 lines
1.3 KiB
C#
56 lines
1.3 KiB
C#
using System;
|
|
using System.Text;
|
|
|
|
namespace Umbraco.Cms.Core.Routing
|
|
{
|
|
public class WebPath
|
|
{
|
|
public const char PathSeparator = '/';
|
|
|
|
public static string Combine(params string[] paths)
|
|
{
|
|
if (paths == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(paths));
|
|
}
|
|
|
|
if (paths.Length == 0)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
|
|
var sb = new StringBuilder();
|
|
|
|
for (var index = 0; index < paths.Length; index++)
|
|
{
|
|
var path = paths[index];
|
|
var start = 0;
|
|
var count = path.Length;
|
|
var isFirst = index == 0;
|
|
var isLast = index == paths.Length - 1;
|
|
|
|
// don't trim start if it's the first
|
|
if (!isFirst && path[0] == PathSeparator)
|
|
{
|
|
start = 1;
|
|
}
|
|
|
|
// always trim end
|
|
if (path[path.Length - 1] == PathSeparator)
|
|
{
|
|
count = path.Length - 1;
|
|
}
|
|
|
|
sb.Append(path, start, count - start);
|
|
|
|
if (!isLast)
|
|
{
|
|
sb.Append(PathSeparator);
|
|
}
|
|
}
|
|
|
|
return sb.ToString();
|
|
}
|
|
}
|
|
}
|