Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Lesson 2: Creating Attributes for Row-Level Security

One common method of defining row-level security is to use the user's login information to determine which rows to display. In this lesson, you will create an attribute within the Employee entity that filters the data based on the user's login information. You will create a filter and then edit the filter as a formula so that you can use the GetUserID function.

NoteNote

This lesson begins with the expectation that Business Intelligence Development Studio is open on your computer still and the report model is displayed in the window.

To create a filtered attribute that is edited as a formula

  1. In tree view, select the Employee entity.

    The Employee attributes are displayed in the list view.

  2. Right-click Employee, point to New, and then click Filter.

    The Filter Data dialog box opens.

  3. In the Fields list, double-click Login ID2.

    A filter condition using the Login ID2 field you created in Lesson 1 is added to the filter.

  4. In the filter, right-click Login ID2 and select Edit As Formula.

    The Define Formula dialog box opens with the formula Login ID2=Empty displayed.

  5. In the Formula box, select the word Empty.

  6. Select the Functions tab and then expand the Information node.

  7. Double-click the GetUserID function.

    Empty is replaced with GetUserID().

  8. Click OK.

    The Define Formula dialog box closes and the filter clause displays Login ID2=GetUserID.

  9. Click OK again.

    The Filter Data dialog box closes and the NewFilter attribute is displayed in the list view. Next, you will rename the attribute.

To rename the attribute

  1. In list view, right-click the NewFilter attribute and select Rename.

  2. Type UserIDFilter.

    Next, you will assign the required attribute properties.

To modify the properties of the attribute

  1. In list view, select the UserIDFilter attribute.

  2. In the Properties window, locate the IsFilter property.

  3. Verify that the IsFilter value is True.

  4. Locate the Hidden property.

  5. Click the Hidden down arrow and then select True.

    Changing the Hidden property to True prevents model users from seeing this attribute when they create reports using the model. Because you are using the attribute as a filter to assign security, users do not need to see this attribute when creating their own reports.

  6. In the list view, select the Login ID2 attribute.

  7. In the Properties window, locate the Nullable property.

    Because the Login ID2 attribute has the Nullable property set to True, the UserIDFilter attribute must have the Nullable property set to True also. However, this is not a required property for use as a security filter.

  8. Click the Nullable down arrow, and then select True.

To assign an attribute to the security filters collection

  1. In tree view, select the Employee entity.

  2. In the Properties window, locate the SecurityFilters property.

  3. Select the SecurityFilters property and then click the ellipsis () button.

    The Attribute Reference Collection Editor dialog box opens.

  4. Click Add.

  5. The Security Filter Attributes dialog box opens.

  6. In the Entities list, verify that the Employee entity is selected.

  7. In the Fields list, select the UserIDFilter attribute.

  8. Click OK and then click OK again.

    Next, you will save the changes in your model and then redeploy the model to the report server.

To save and deploy the report model

  1. On the File menu, click Save All.

  2. In Solution Explorer, right-click the Adventure Works Model project and select Deploy.

    The model is deployed to the report server.

    Important noteImportant

    To verify that the model was deployed successfully, you can view the Error List tab. If an error occurs, you will need to troubleshoot the problem before continuing.

You have now created an attribute and assigned it to the SecurityFilters collection. Next, you need to enable model item security in SQL Server Management Studio. See Lesson 3: Enabling Row-Level Security in Report Manager.

Community Additions

ADD
Show:
© 2015 Microsoft