From d30312c23f8c98dca1d36e017a70b0a5072afd07 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Sat, 16 Jul 2022 22:17:57 -0400 Subject: [PATCH] Add access restrictions to UI (#19) - Vary default user access for new web logs (#19) - Add htmx detection to not auth/404 handlers - Bump version --- src/MyWebLog.Domain/ViewModels.fs | 5 + src/MyWebLog/DotLiquidBespoke.fs | 2 +- src/MyWebLog/Handlers/Error.fs | 21 --- src/MyWebLog/Handlers/Helpers.fs | 146 ++++++++++++++----- src/MyWebLog/Handlers/User.fs | 5 +- src/MyWebLog/Maintenance.fs | 13 +- src/MyWebLog/MyWebLog.fsproj | 1 - src/MyWebLog/appsettings.json | 2 +- src/admin-theme/_layout.liquid | 22 ++- src/admin-theme/category-list-body.liquid | 7 +- src/admin-theme/dashboard.liquid | 28 ++-- src/admin-theme/page-list.liquid | 33 +++-- src/admin-theme/permalinks.liquid | 9 +- src/admin-theme/post-list.liquid | 21 +-- src/admin-theme/rss-settings.liquid | 7 +- src/admin-theme/tag-mapping-list-body.liquid | 7 +- src/admin-theme/upload-list.liquid | 31 ++-- src/admin-theme/version.txt | 2 +- src/default-theme/single-post.liquid | 4 +- 19 files changed, 229 insertions(+), 137 deletions(-) delete mode 100644 src/MyWebLog/Handlers/Error.fs diff --git a/src/MyWebLog.Domain/ViewModels.fs b/src/MyWebLog.Domain/ViewModels.fs index 8ed5232..0334d8f 100644 --- a/src/MyWebLog.Domain/ViewModels.fs +++ b/src/MyWebLog.Domain/ViewModels.fs @@ -92,6 +92,9 @@ type DisplayPage = { /// The ID of this page id : string + /// The ID of the author of this page + authorId : string + /// The title of the page title : string @@ -121,6 +124,7 @@ type DisplayPage = static member fromPageMinimal webLog (page : Page) = let pageId = PageId.toString page.id { id = pageId + authorId = WebLogUserId.toString page.authorId title = page.title permalink = Permalink.toString page.permalink publishedOn = page.publishedOn @@ -136,6 +140,7 @@ type DisplayPage = let _, extra = WebLog.hostAndPath webLog let pageId = PageId.toString page.id { id = pageId + authorId = WebLogUserId.toString page.authorId title = page.title permalink = Permalink.toString page.permalink publishedOn = page.publishedOn diff --git a/src/MyWebLog/DotLiquidBespoke.fs b/src/MyWebLog/DotLiquidBespoke.fs index 9c25f17..22af39e 100644 --- a/src/MyWebLog/DotLiquidBespoke.fs +++ b/src/MyWebLog/DotLiquidBespoke.fs @@ -188,7 +188,7 @@ type UserLinksTag () = let link it = WebLog.relativeUrl webLog (Permalink it) seq { """