Forum Discussion

CBO2404's avatar
CBO2404
Helper II
1 year ago
Solved

how should I protect data when RLS is not an option?

I have two tables, one for comments in a report (Fact_reports) and one for access permission (Fact_access). A report can always be viewed, except when a select number of users are listed in the acce...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi CBO2404 ,

    I think you can do these steps below:

     

    1. Create a relationship between the Fact_Reports and Fact_Access tables based on the reportid column.

     

    2. You can create two measures.

    HasAccess = 
    VAR CurrentUser = USERPRINCIPALNAME()
    VAR ReportID = SELECTEDVALUE(Fact_Reports[reportid])
    RETURN
    IF(
        ISBLANK(LOOKUPVALUE(Fact_Access[userprinciple], Fact_Access[reportid], ReportID, Fact_Access[userprinciple], CurrentUser)),
        TRUE(),
        FALSE()
    )
    VisibleComments = 
    IF(
        [HasAccess],
        COUNTROWS(Fact_Reports),
        BLANK()
    )

     

    3. Use the measure in your visual to filter the comments. You can add the VisibleComments measure to your visual to ensure that only the comments the user has access to are displayed.

     

     

    Best Regards

    Yilong Zhou

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.