I have a dashboard for doctors. It will show results for one doctor at a time. If the user viewing the report is an admin, I want to allow that user to select which doctor he or she wants to view. If the user is an ordinary user, that user can see only his
or her results.
This is the approach that I am considering. I have two tables: Users and Doctors.
The key of the Users table is the Active Directory login for the users who have access to the report. There is a column called DashboardRole. If A is in the DashboardRole column then the user is an admin. I have a derived column IsAdmin
which basically is: CASE WHEN DashboardRole like '%A%' then 1 else 0 end as IsAdmin. In addition, the Users table has a DefaultDoctor column that is a foreign key to the pk of the Doctor table
I am putting both tables into Shared Datasets and am considering caching each of the datasets.
I added a filter in my report on the Users dataset, where Fields!UserName.Value =User!UserID
That should return either one or no rows.
Next I have two internal parameters: IsAdmin and DefaultDoctor which have as defaults the values from the Users dataset. These can either be empty or they can have a value.
Finally, I have the following filter on my Doctors dataset: =Parameters!IsAdmin.Value = 1 ORELSE Fields!DoctorKey.Value = Parameters!DefaultDoctor.Value
I have a Doctor parameter. It has available values from the Doctors dataset. It gets its default value from the Users dataset.
Here are my three key scenarios for the Doctor parameter:
User is admin:
The Available values for Doctor is a list of all Doctors. The default Doctor is the DefaultDoctor in the user table.
User is not admin
The Available values for Doctor is just the DefaultDoctor associated with that user. The Doctor parameter has the value of the DefaultDoctor.
User is not in system
There are no available values for Doctor and no default. The user does not have access to any of the data.
My question: What are the holes in this proposed approach? Can you think of a way around this security? Outside of changing my base tables, can I change the data in the shared datasets somehow, without being an elevated SQL User?
Russel Loski, MCSE Data Platform/Business Intelligence Twitter: @sqlmovers; blog: www.sqlmovers.com