Home > Blockchain >  Using the domain from a user login as a parameter in SSRS
Using the domain from a user login as a parameter in SSRS

Time:03-12

I have been tasked with creating a report that will be used for multiple domains. The issue I am having is that the user's domain needs to automatically restrict the data they can see to only their domain. My current thought is to use the domain from their login as a parameter that will be hidden so the user doesn't have access to change it. Is this even possible? I have been searching the internet, but I can't find this use of a login. The object of the report is to show logins without permissions but only for the user's domain.

My current script is:

DECLARE @Domain VARCHAR(50)
DECLARE @StartDate DATE

SELECT  userName, datetime, message, appDomain
FROM table
WHERE  message LIKE '%No Permissions%' 
    AND (CONVERT(DATE, dateTime) >= @StartDate AND CONVERT(DATE, dateTime) <= DATEADD(dd, 7, @StartDate))
    AND table.appDomain = @Domain

CodePudding user response:

You can use User!UserID for this.

You can set your parameter's default value to =User!UserID and then pass that to your query as normal.

  • Related