10ecdfa2e4
Adds the SQL Server Data Tools project for the fuchs_fds database — tables, table types, functions and stored procedures that the backend calls (e.g. fds__getInvoice, fds__merge_bankingtransactions, fds__tt__bankingtransactions, fds__admin_getReportCatalog, fis_* auth). Build/model caches (bin, obj, *.dbmdl, *.jfm, *.user) are git-ignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
29 lines
1.1 KiB
Transact-SQL
29 lines
1.1 KiB
Transact-SQL
-- =============================================
|
|
-- Author: <Author,,Name>
|
|
-- Create date: <Create Date, ,>
|
|
-- Description: <Description, ,>
|
|
-- =============================================
|
|
CREATE FUNCTION [dbo].[fis_admin_testGroupMembership]
|
|
(
|
|
@useraccount_id varchar(5)
|
|
,@usergroup_id varchar(1000)
|
|
)
|
|
RETURNS bit
|
|
AS
|
|
BEGIN
|
|
DECLARE @groups TABLE([usergroup_id] varchar(5));
|
|
INSERT INTO @groups SELECT * from STRING_SPLIT(@usergroup_id,',');
|
|
|
|
DECLARE @isMember bit = CASE WHEN EXISTS (SELECT * FROM [dbo].[fis_usergroups] as g
|
|
JOIN @groups as groupstotest On groupstotest.[usergroup_id] = g.[usergroup_id]
|
|
JOIN [dbo].[fis_usergroups_members] as gm on g.[usergroup_id] = gm.[usergroup_id] and gm.[DateDeleted] is null AND g.[DateDeleted] is null
|
|
JOIN [dbo].[fis_useraccounts] as u on gm.[useraccount_id] = u.[useraccount_id]
|
|
WHERE u.[DateDeleted] is null AND u.[DateDisabled] is null
|
|
and u.[useraccount_id] = @useraccount_id
|
|
and g.[DateDeleted] is null
|
|
)
|
|
THEN 1 ELSE 0 END;
|
|
|
|
RETURN @isMember;
|
|
|
|
END |