Reply
Regular Visitor
Posts: 39
Registered: ‎04-05-2017

Use row-level security (RSL) need to set for embedded report

I have one table where I have to check two roles. One is "TenantID" and User Level. Can you please help with this.

 

TenantID = username() && User Level = username() 

 

Above this, I set the roles?

 

Report should be filtered via Tenant and then user level role.  

 

Please let me know how to call this role in embedded code 

 

var generateTokenRequestParameters = new GenerateTokenRequest("View", null, identities: new List<EffectiveIdentity> { new EffectiveIdentity(username: "username", roles: new List<string> { "roleA", "roleB" }, datasets: new List<string> { "datasetId" }) });

var tokenResponse = await client.Reports.GenerateTokenInGroupAsync("groupId", "reportId", generateTokenRequestParameters);

 

or 

 

{ "accessLevel": "View", "identities": [ { "username": "EffectiveIdentity", "roles": [ "Role1", "Role2" ], "datasets": [ "fe0a1aeb-f6a4-4b27-a2d3-b5df3bb28bdc" ] } ] }

image.png

 

 

 

Highlighted
Community Support Team
Posts: 5,378
Registered: ‎05-02-2017

Re: Use row-level security (RSL) need to set for embedded report

Hi @mayank08,

 

Please mark the private information.

May I ask if it's necessary to use two conditions? You can do it in the local application. For example, even if there are two users have same userID, the pseudo-code is as below.

if TenantID = "T001" && UserID = "Nilesh" then
    {
    "accessLevel": "View",
    "identities": [
        {
            "username": "Nilesh",
            "roles": [ "Role1", "Role2" ],
            "datasets": [ "fe0a1aeb-f6a4-4b27-a2d3-b5df3bb28bdc" ]
        }
    ]
}

else if TenantID = "T002" && UserID = "Nilesh" then
 {
    "accessLevel": "View",
    "identities": [
        {
            "username": "Nilesh",
            "roles": [ "Role3", "Role4", "Role5" ],
            "datasets": [ "fe0a1aeb-f6a4-4b27-a2d3-b5df3bb28bdc" ]
        }
    ]
}

Finally, different users get different tokens.

Reference: embedded-row-level-security#applying-user-and-role-to-an-embed-token

 

Best Regards,

Dale