feat(produser): added the ability to add a prod user by default roles and update if already there

This commit is contained in:
2025-06-09 16:42:49 -05:00
parent ed44b11e5c
commit ad4c9502fa
12 changed files with 2505 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
export const userCheck = `
SELECT *,
'[' + STUFF((
SELECT ',' + '"' + REPLACE(REPLACE(ur.name, '\', '\\'), '"', '\"') + '"'
FROM [test1_AlplaPROD2.0_Read].[user].[Roles] (nolock) ur
WHERE ur.userid = u.id
FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'
), 1, 1, '') + ']' AS roles,
'[' + STUFF((
SELECT ',' + cast(ulr.roleid as nvarchar(max))
FROM [test1_AlplaPROD2.0_Read].[user].[LegacyRoles] (nolock) ulr
WHERE ulr.userid = u.id
FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'
), 1, 1, '') + ']' AS legacyRoles
FROM [test1_AlplaPROD2.0_Read].[user].[User] (nolock) u
where Loginname = '[userName]'
`;