Get my id from SSRS report without user id function - reporting-services

I'm connecting SSRS to SQL server using service id 'domain\xyz'. But when I open [ReportServer].[dbo].[ExecutionLog], I see my user id 'abc'. How to find out my id on report. I'm trying to understand how user id 'abc' is stored in this [ReportServer].[dbo].[ExecutionLog] when am connecting using service id 'domain\xyz'.Is there a way, I can get display my id without using "user id" function as a paramter?

Related

Google Data Studio filter by email and allow all access

I'm creating a Google Data Studio dashboard with the filter by email option. It's easy to do it when you want to allow the user to see only one option, for example
user region
alice A
bob F
charlie Z
But how can I do to give access to some user to all regions from A to Z? Is there a better way to do it than simply creating 26 rows for every user with this admin access?
I'd like to avoid creating this table:
user region
admin A
admin B
admin C
...
admin Z
and instead do something similar to this
user region
admin *
In bigquery connector, you can write custom query like -
select *
FROM table_name
where
case when #DS_USER_EMAIL IN (select distinct map_field from table_name )
then #DS_USER_EMAIL
else 'all' end = map_field
You will have to create a mapping for 'all' one time. But this works. No need to use feature - filter by email id

SSRS When uploading report owner name is wrong

I have SQL 2014 professional version 12.0.5000.0 with SSRS runing. eI have created a report in report builder 3.0 which works and runs find.
However when I go to create a subscription and run I get the user a1234 (as a example ) don't exist.
I looked there is no user with that name added to SSRS or in our domain.
my user name is ah1234 (as a example )
I looked in the subscription table and the owner is me ? However, the subscription is showing the owner as a1234?
I checked the report I uploaded it says the owner is a1234.
I'm thinking it might be a active directory issue but not sure.
Has anyone has see this before if so how can I fix the owner name of the subscription?
I don't know how SSRS has corrupted the owner name but here is a trick (written on 2008 R2) to correct owner names (I use this when people leave & their Active Directory user id gets deleted leaving orphaned subs that will not run).
Note that it updates the Microsoft-supplied subscriptions table, you may not wish to do that.
First identify the SSRS owner id for the from-person & also that of the to-person (you may need to get the to-person to create a subscription first):
SELECT distinct [OwnerID], u.username
FROM [<ssrs-database>].[dbo].[Subscriptions] s
join [<ssrs-database>].[dbo].[Users] u on s.ownerid = u.userid
Now make a safe copy of the subscriptions list, e.g.:
SELECT * into temp.subscriptionscpy
FROM [<ssrs-database>].[dbo].[Subscriptions] s
Now make the change, e.g. (this one changes the owner of all relevant subs):
update [<ssrs-database>].[dbo].[Subscriptions]
set ownerid = 'DDD87598-8957-42C8-8DBC-A893E7174CB6'
where ownerid = 'EBF0E483-69E6-4458-B171-BA28FFCCDF3F'
Now check the owner is as you want it.

Get user full_name in .values() Django ORM

How to get user__get_full_name while selecting .values() on any modal?
Pageview.objects.values('visitor__user__username').annotate(url_count=Count('url')).annotate(url_count_unique=Count('url', distinct=True))
I want to
Rename visitor__user__username to some alias for example user
Get user's full_name instead of username
Optimize the query if possible.
Thanks,
Get full name is a method on the user model and does not map directly to a db row attribute. You wont be able to get it with .values().

How to retrieve a specific data from database in ASP and put that data in a variable

Problem: I have a database called admin which has id, username and password column. Now I need to put this id in a variable called Dim ID for a specific username.
If I run this query:
adoRS.Source = "SELECT * FROM admin WHERE username= '"& username &"' AND password ='"& password &"' "
I will get a particular row in the database and a particular id. So, the problem is how to retrieve that id from the above query and put it in the declared variable called ID
One particular solution would be using a while loop as shown below:
do
col1 = adoRS.Fields("id")
id = col1
adoRS.MoveNext
Loop While Not adoRS.EOF
Since we just have one piece of data in the col1 variable, it would be much nicer if we could skip the do while process. So the question is how you retrieve the data and put that data in the id variable without using a while loop statement.
When using an ADO recordset, if you just want the value, you can just grab the value.
ID = adoRS.Fields("ID").Value
If the admin table is going to have more than one row with the same userName and Password, you probably have problems elsewhere, but will want to either send whatever you're doing with ID off to a method, or load up all of the ID's into an array.
If there are more than a handful, the getRows method may be useful as well.
(And, really, you shouldn't do a SELECT * if you just want ID. SELECT ID FROM Admin should work just fine. And sanitize USER and PASSWORD when you build that SQL string. Consider using a command object. And don't store the password, store a hash of the password. And eat your vegetables.)

Auto username suggestion

I want an auto username suggestion if a username is already used ,using mysql procedure
By User Name suggestion, do you mean you want a type-ahead autocomplete on a login form (i.e. once you type a few characters of your user name, the application will show all user names matching the supplied user name), or do you you mean a suggestion box that provides potential alternate user names if new user supplies an existing user name?
If you're looking for the first, I would recommend avoiding this. By providing a server-side autocomplete for user names, you are providing a simple way to access the names of all users in your system and reducing security (as people trying to access your site without permission will only need to determine a password instead of a user name and password).
If it's the second, one common approach is to append numbers at the end of an existing user name to provide a user name that does not exist. I would recommend doing this in a combination of MySQL and whatever server-side language you are using.
First, get all user names that start with the user name that was supplied (and already exists):
SELECT user_name FROM users where user_name LIKE #userName + '%'
Then, in your server side language, do the following (pseudo-code)
let user = username supplied (already exists)
let recordset = recordset from db call (above)
i = 0
alternateCount = 0
alternatesFound = new string[5]
while (alternateCount < 5 And i < 100)
potentialName = user + i
if (recordset does not contain potentialName)
alternatesFound[alternateCount] = potentialName
alternateCount++
end if
end while
What this does is attempts to insert sucessive numbers (1,2,3) etc. to the supplied user name until it finds 5 cases where the user name is unique. It also does a maximum of 100 iterations in case user1 - user99 is taken (you could increase this but a limit isn't a bad idea.