feat: 用户维护增加给定默认授权功能

This commit is contained in:
Argo-Tianyi 2022-01-06 02:45:05 +08:00
parent 4cb59e5d03
commit 808dc444b1
3 changed files with 2 additions and 4 deletions

View File

@ -186,7 +186,7 @@ class UserService : BaseDatabase, IUser
// 开始事务
Database.BeginTransaction();
// 插入用户
Database.Execute("INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, [Description]) values (@0, @1, @2, @3, @4, @4, 'system', '系统默认创建');", userName, pwd, salt, displayName, DateTime.Now);
Database.Execute("INSERT INTO Users (UserName, Password, PassSalt, DisplayName, RegisterTime, ApprovedTime, ApprovedBy, Description) values (@0, @1, @2, @3, @4, @4, 'system', '系统默认创建');", userName, pwd, salt, displayName, DateTime.Now);
// 授权 Default 角色
Database.Execute("insert into UserRole (UserID, RoleID) select ID, (select ID from Roles where RoleName = 'Default') RoleId from Users where UserName = @0", userName);

View File

@ -1,7 +1,7 @@
@page "/Admin/Users"
<Table TItem="DataAccess.Models.User" IsBordered="true" IsStriped="true" IsMultipleSelect="true"
ExtendButtonColumnWidth="270" SortList="SortList"
ExtendButtonColumnWidth="270"
ShowToolbar="true" ShowExtendButtons="true" ShowSearch="true"
UseInjectDataService="true">
<TableToolbarTemplate>

View File

@ -30,8 +30,6 @@ public partial class Users
[NotNull]
private IUser? UserService { get; set; }
private List<string> SortList { get; } = new List<string> { "UserName" };
private static bool GetDisabled(string? id) => !string.IsNullOrEmpty(id);
private List<IValidator> UserRules { get; } = new List<IValidator>();