新建用户默认授予Default角色
This commit is contained in:
parent
815fb08c5c
commit
34ea921d1f
|
@ -80,6 +80,7 @@ SET IDENTITY_INSERT [dbo].[UserGroup] OFF
|
|||
DELETE FROM UserRole
|
||||
SET IDENTITY_INSERT [dbo].[UserRole] ON
|
||||
INSERT [dbo].[UserRole] ([ID], [UserID], [RoleID]) VALUES (1, 1, 1)
|
||||
INSERT [dbo].[UserRole] ([ID], [UserID], [RoleID]) VALUES (2, 1, 2)
|
||||
SET IDENTITY_INSERT [dbo].[UserRole] OFF
|
||||
|
||||
DELETE FROM NavigationRole
|
||||
|
|
|
@ -201,7 +201,10 @@ BEGIN
|
|||
declare @approveTime datetime = null
|
||||
if @userStatus = 0 set @approveTime = GETDATE()
|
||||
if(@id = 0 and not exists (select 1 from Users Where UserName = @userName))
|
||||
begin
|
||||
Insert Into Users (UserName, [Password], PassSalt, DisplayName, RegisterTime, ApprovedTime, [Description]) values (@userName, @password, @passSalt, @displayName, GETDATE(), @approveTime, @description)
|
||||
insert into UserRole (UserID, RoleID) select @@IDENTITY, ID from Roles where RoleName = N'Default'
|
||||
end
|
||||
else
|
||||
Update Users set [Password] = @password, PassSalt = @passSalt, DisplayName = @displayName where ID = @id
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue