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>
79 lines
2.0 KiB
Transact-SQL
79 lines
2.0 KiB
Transact-SQL
|
|
|
|
|
|
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE PROCEDURE [dbo].[fis_admin_createUserAccount]
|
|
@authaccount varchar(5)
|
|
,@name nvarchar(100)
|
|
,@firstname nvarchar(100)
|
|
,@title varchar(50)
|
|
,@gender varchar(1)
|
|
,@email varchar(255)
|
|
,@mobile varchar(50)
|
|
,@password nvarchar(20)
|
|
,@enc_key uniqueidentifier
|
|
AS
|
|
BEGIN
|
|
SET NOCOUNT ON;
|
|
|
|
DECLARE @utcnow datetime = GETUTCDATE();
|
|
DECLARE @auth smallint = [dbo].[fis_admin_getUserAuth](@authaccount);
|
|
DECLARE @newid varchar(5);
|
|
|
|
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 |