Let admins create and delete users in Benutzerverwaltung, modernize list
Playwright Tests / test (push) Canceled after 0s
Playwright Tests / test (push) Canceled after 0s
Wire up two previously-unwired stored procedures for the usr module: - fis_admin_createUserAccount gained the missing @authaccount + intranet_admin auth gate, a duplicate-email check, and now returns the (possibly auto-generated) password so it can be emailed to the new user, mirroring fis_admin_resetUserPassword's pattern. - fis_admin_delUserAccount gained the same missing auth gate plus a guard against an admin deleting their own account. New /do/usr/create and /do/usr/delete endpoints in IntranetController.AdminUsers.cs, a "Neuer Benutzer" button and a "Benutzer löschen" ribbon action in fis.usr.js, and unit tests for the new welcome-email content (BuildWelcomeEmail). Also restyle the user list (fis.usr.scss) from a plain bordered table to a card-style row grid with avatar-initial badges and status pills, matching the Admin dashboard's visual language. Documented as ADR 0020 and in the admin-user-management concept doc. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
38145a917e
commit
4386a6336a
@@ -7,7 +7,8 @@
|
||||
-- Description: <Description, ,>
|
||||
-- =============================================
|
||||
CREATE PROCEDURE [dbo].[fis_admin_createUserAccount]
|
||||
@name nvarchar(100)
|
||||
@authaccount varchar(5)
|
||||
,@name nvarchar(100)
|
||||
,@firstname nvarchar(100)
|
||||
,@title varchar(50)
|
||||
,@gender varchar(1)
|
||||
@@ -20,41 +21,59 @@ BEGIN
|
||||
SET NOCOUNT ON;
|
||||
|
||||
DECLARE @utcnow datetime = GETUTCDATE();
|
||||
DECLARE @auth smallint = [dbo].[fis_admin_getUserAuth](@authaccount);
|
||||
DECLARE @newid varchar(5);
|
||||
|
||||
INSERT INTO [dbo].[fis_useraccounts]
|
||||
([useraccount_id]
|
||||
,[name_enc]
|
||||
,[firstname_enc]
|
||||
,[title_enc]
|
||||
,[gender_enc]
|
||||
,[email_enc]
|
||||
,[mobile_enc]
|
||||
,[password_enc]
|
||||
,[UserDisabled]
|
||||
,[DateDisabled]
|
||||
,[UserCreated]
|
||||
,[DateCreated]
|
||||
,[UserModified]
|
||||
,[DateModified]
|
||||
,[UserDeleted]
|
||||
,[DateDeleted])
|
||||
OUTPUT inserted.[useraccount_id]
|
||||
VALUES
|
||||
([dbo].[fis_fn_useraccount_id] ()
|
||||
,ENCRYPTBYKEY(@enc_key, @name)
|
||||
,ENCRYPTBYKEY(@enc_key, @firstname)
|
||||
,ENCRYPTBYKEY(@enc_key, @title)
|
||||
,ENCRYPTBYKEY(@enc_key, @gender)
|
||||
,ENCRYPTBYKEY(@enc_key, @email)
|
||||
,ENCRYPTBYKEY(@enc_key, @mobile)
|
||||
,CASE WHEN @password is null then ENCRYPTBYKEY(@enc_key, CAST([dbo].[ocms_fn_generatePassword] (8, 0, 1, 1) AS nvarchar(20))) ELSE ENCRYPTBYKEY(@enc_key, @password) END
|
||||
,NULL --[UserDisabled]
|
||||
,NULL --[DateDisabled]
|
||||
,'sa'
|
||||
,@utcnow
|
||||
,'sa'
|
||||
,@utcnow
|
||||
,NULL
|
||||
,NULL);
|
||||
IF @auth > 1
|
||||
BEGIN
|
||||
|
||||
IF EXISTS (SELECT * FROM [dbo].[fis_useraccounts] WHERE [DateDeleted] is null AND ISNULL(@email,'') <> '' AND LTRIM(RTRIM(DECRYPTBYKEY([email_enc]))) like LTRIM(RTRIM(@email)))
|
||||
THROW 60001, 'email is already assigned to another account', 1;
|
||||
|
||||
IF @password IS NULL
|
||||
BEGIN
|
||||
SET @password = [dbo].[ocms_fn_generatePassword] (8, 0, 1, 1);
|
||||
END
|
||||
|
||||
SET @newid = [dbo].[fis_fn_useraccount_id] ();
|
||||
|
||||
INSERT INTO [dbo].[fis_useraccounts]
|
||||
([useraccount_id]
|
||||
,[name_enc]
|
||||
,[firstname_enc]
|
||||
,[title_enc]
|
||||
,[gender_enc]
|
||||
,[email_enc]
|
||||
,[mobile_enc]
|
||||
,[password_enc]
|
||||
,[UserDisabled]
|
||||
,[DateDisabled]
|
||||
,[UserCreated]
|
||||
,[DateCreated]
|
||||
,[UserModified]
|
||||
,[DateModified]
|
||||
,[UserDeleted]
|
||||
,[DateDeleted])
|
||||
VALUES
|
||||
(@newid
|
||||
,ENCRYPTBYKEY(@enc_key, @name)
|
||||
,ENCRYPTBYKEY(@enc_key, @firstname)
|
||||
,ENCRYPTBYKEY(@enc_key, @title)
|
||||
,ENCRYPTBYKEY(@enc_key, @gender)
|
||||
,ENCRYPTBYKEY(@enc_key, @email)
|
||||
,ENCRYPTBYKEY(@enc_key, @mobile)
|
||||
,ENCRYPTBYKEY(@enc_key, @password)
|
||||
,NULL --[UserDisabled]
|
||||
,NULL --[DateDisabled]
|
||||
,@authaccount
|
||||
,@utcnow
|
||||
,@authaccount
|
||||
,@utcnow
|
||||
,NULL
|
||||
,NULL);
|
||||
|
||||
SELECT TOP(1) *, @password as [newpassword] FROM [dbo].[fis_admin_getUserAccountList](@authaccount, @newid, null, null);
|
||||
|
||||
END
|
||||
|
||||
END
|
||||
@@ -12,17 +12,23 @@ AS
|
||||
BEGIN
|
||||
SET NOCOUNT ON;
|
||||
DECLARE @utcnow datetime = GETUTCDATE();
|
||||
DECLARE @auth smallint = [dbo].[fis_admin_getUserAuth](@authaccount);
|
||||
|
||||
IF EXISTS (SELECT * FROM [dbo].[fis_useraccounts] WHERE [useraccount_id] = @useraccount_id and [DateDeleted] is null)
|
||||
BEGIN
|
||||
IF @auth > 1 AND @authaccount <> @useraccount_id
|
||||
BEGIN
|
||||
|
||||
UPDATE [dbo].[fis_useraccounts]
|
||||
SET [UserDeleted] = @authaccount
|
||||
,[DateDeleted] = @utcnow
|
||||
WHERE
|
||||
[useraccount_id] = @useraccount_id;
|
||||
IF EXISTS (SELECT * FROM [dbo].[fis_useraccounts] WHERE [useraccount_id] = @useraccount_id and [DateDeleted] is null)
|
||||
BEGIN
|
||||
|
||||
END
|
||||
UPDATE [dbo].[fis_useraccounts]
|
||||
SET [UserDeleted] = @authaccount
|
||||
,[DateDeleted] = @utcnow
|
||||
WHERE
|
||||
[useraccount_id] = @useraccount_id;
|
||||
|
||||
END
|
||||
|
||||
END
|
||||
|
||||
SELECT CAST((CASE WHEN NOT EXISTS (SELECT * FROM [dbo].[fis_useraccounts] WHERE [useraccount_id] = @useraccount_id and [DateDeleted] is null) THEN 1 ELSE 0 END) as bit);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user