Let admins create and delete users in Benutzerverwaltung, modernize list
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:
Stefan
2026-09-14 14:51:59 +02:00
co-authored by Claude Sonnet 5
parent 38145a917e
commit 4386a6336a
14 changed files with 716 additions and 138 deletions
@@ -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