Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

Retrieve Power BI reports based on user role only

I'm developing an app in which I'm retrieving Power BI reports from a specific workspace as it follows:

 

 

var reports = await pbiClient.Reports.GetReportsInGroupAsync(workspaceId);

This works fine. But, it retrieves all reports, doesn't mind the user role. In order to generate the token request, I do the following:

 

GenerateTokenRequest generateTokenRequestParameters =
       new GenerateTokenRequest(accessLevel: accessLevel,
                               identities: new List<EffectiveIdentity> {
                                  new EffectiveIdentity(username: currentUser.UserName,
                                                        datasets: new List<string> { datasetId  },
                                                        roles: roles)
                               });

This code works fine, in which roles are the user specific roles for this session. When showing the report, if the user doesn't have permissions for it, it still shows it, but it looks ugly and the user can't view anything on it.

 

What I need to do, is filter all returned reports based on user role, and don't get if it the user doesn't have permissions on it. How can I achieve this programmatically?

 

No Replies