feat: Enhance user group management and transaction handling in stored procedures
- Improved user group deletion logic to accurately report success or failure. - Updated user group renaming checks to prevent unintended inserts or updates. - Added documentation on transaction blocking risks during full resets in stored procedures. - Removed unnecessary login scripts from database project.
This commit is contained in:
@@ -17,9 +17,14 @@ BEGIN
|
||||
|
||||
DECLARE @createdID as TABLE ([id] varchar(5));
|
||||
|
||||
IF @auth > 1
|
||||
-- Renaming an existing group (@usergroup_id supplied) requires that id to currently be an
|
||||
-- active group; otherwise the MERGE below would silently INSERT it as a brand-new group
|
||||
-- (rename-of-unknown-id becoming create) or resurrect/UPDATE a soft-deleted row without
|
||||
-- clearing its DateDeleted (leaving it deleted yet renamed). @usergroup_id = NULL (create)
|
||||
-- always passes this check.
|
||||
IF @auth > 1 AND (@usergroup_id IS NULL OR EXISTS (SELECT * FROM [dbo].[fis_usergroups] WHERE [usergroup_id] = @usergroup_id AND [DateDeleted] IS NULL))
|
||||
BEGIN
|
||||
|
||||
|
||||
MERGE [dbo].[fis_usergroups] as TARGET
|
||||
USING (VALUES( ISNULL(@usergroup_id, [dbo].[fis_fn_id] ('fis_usergroups'))
|
||||
,ENCRYPTBYKEY(@enc_key, @name)
|
||||
|
||||
Reference in New Issue
Block a user