From d77d4786aa8348fecee7cb580cc9eee412d5ddde Mon Sep 17 00:00:00 2001
From: zhangpeihang <948869991@qq.com>
Date: Thu, 20 Jan 2022 00:20:03 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E7=94=A8=E6=88=B7=E9=A1=B5=E9=9D=A2?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=8C=89=E9=92=AE=E6=9D=83=E9=99=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Pages/Admin/Users.razor | 2 +-
.../Pages/Admin/Users.razor.cs | 21 +++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor
index bf1d4c12..12fb1a17 100644
--- a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor
+++ b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor
@@ -1,7 +1,7 @@
@page "/Admin/Users"
diff --git a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor.cs b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor.cs
index 344e3007..436c4fd2 100644
--- a/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor.cs
+++ b/src/blazor/admin/BootstrapAdmin.Web/Pages/Admin/Users.razor.cs
@@ -1,6 +1,7 @@
using BootstrapAdmin.DataAccess.Models;
using BootstrapAdmin.Web.Core;
using BootstrapAdmin.Web.Extensions;
+using BootstrapAdmin.Web.Services;
using BootstrapAdmin.Web.Validators;
namespace BootstrapAdmin.Web.Pages.Admin;
@@ -30,6 +31,19 @@ public partial class Users
[NotNull]
private IUser? UserService { get; set; }
+
+ [Inject]
+ [NotNull]
+ private INavigation? NavigationService { get; set; }
+
+ [Inject]
+ [NotNull]
+ private NavigationManager? NavigationManager { get; set; }
+
+ [Inject]
+ [NotNull]
+ private BootstrapAppContext? AppContext { get; set; }
+
private static bool GetDisabled(string? id) => !string.IsNullOrEmpty(id);
private List UserRules { get; } = new List();
@@ -71,4 +85,11 @@ public partial class Users
{
return Task.FromResult(UserService.SaveUser(user.UserName, user.DisplayName, user.NewPassword));
}
+
+ private bool AuthorizeButton(string operate)
+ {
+ var url = NavigationManager.ToBaseRelativePath(NavigationManager.Uri);
+
+ return NavigationService.AuthorizationBlock(url, AppContext.UserName, operate);
+ }
}