




alter FUNCTION ufn_JIWA_SecurityPredicateDebtors (@DebtorID CHAR(20))
RETURNS TABLE
WITH SCHEMABINDING
AS
RETURN SELECT 1 AS ufn_JIWA_SecurityPredicateDebtors_result
FROM dbo.DB_Main
JOIN dbo.DB_Category1 ON dbo.DB_Category1.Category1ID = dbo.DB_Main.Category1ID
JOIN dbo.SY_UserGroups ON dbo.SY_UserGroups.Name = dbo.DB_Category1.Description or dbo.SY_UserGroups.Name = 'Admin'
JOIN dbo.SY_UserGroupMemberships ON dbo.SY_UserGroupMemberships.SY_UserGroups_RecID = dbo.SY_UserGroups.RecID
JOIN dbo.HR_Staff ON dbo.HR_Staff.StaffID = dbo.SY_UserGroupMemberships.HR_Staff_StaffID
JOIN dbo.SY_ProcessID ON SY_ProcessID.HR_Staff_StaffID = dbo.HR_Staff.StaffID
WHERE dbo.SY_ProcessID.SPID = @@SPID
AND DB_Main.DebtorID = @DebtorID
GO


Ernst wrote:OK, so every time I run a report,it runs under the admin SPID,why would it do that, and not run under the usernames SPID?


Return to Technical and or Programming
Users browsing this forum: No registered users and 2 guests