Sdílet prostřednictvím


Lesson 1: Setting Up Permissions for this Tutorial

New: 14 April 2006

Before you can follow this tutorial, you will need to set up the computer that you are using for this tutorial. In addition, you will need to create an attribute that changes the login information for some fictional AdventureWorks employees so that you can set row-level security permissions. Typically, you would not need to perform any of the steps in this lesson when setting up your own security filters because your group and user permissions and login accounts will already be set up, and your report model will already be deployed.

To set up your computer for this tutorial, you will need to do the following in this lesson:

Note

This tutorial assumes that the server and client computers being used for this tutorial are the same computer.

  • Create two temporary user accounts on the computer that you are using for this tutorial using the Computer Management tool. The fictitious users, Rachel Valdez (Rachel0) and Garrett Vargas (Garrett1) already exist in the AdventureWorks sample database. You will use these temporary user accounts in a later lesson to see the results of this tutorial.
  • Grant these fictitious users permission to access the report server and the Report Manager by assigning them catalog roles and system roles.
  • Modify the report model and deploy it to the report server. To accurately show how security filters work, you will need to create a new field that maps fictitious users from the AdventureWorks database to the temporary user accounts you created on your computer.
  • Create a new login that the report model will use to access the AdventureWorks database.

Important

These settings are created for the purposes of this tutorial only. Your SQL Server production environment should be set up differently and, therefore, the steps in this Lesson are not required when setting up security filters. Remember to change these settings back after you complete this tutorial.

To create computer user accounts

  1. Click Start, point to Control Panel, point to Administrative tools, and then click Computer Management.

  2. In the Computer Management (Local) pane, double-click Local Users and Groups.

  3. Right-click the Users folder and then select New User.

    The New User dialog box opens.

  4. In the User name box, type Rachel0.

  5. In the Full name box, type Rachel Valdez.

  6. In the Description box, type Account used for the Model Security tutorial.

  7. In the Password box, type Pass12,Word.

    Note

    To help keep your computer more secure, you should always use a strong password. A strong password should be at least seven characters long, and contain characters from the following three groups: Letters, Numerals, and Symbols.

  8. In the Confirm password box, type Pass12,Word.

  9. Clear the User must change password at next logon check box, and then click Create.

    Rachel0 is added to the list of users. The New User dialog box remains open.

  10. In the User name box, type Garrett1.

  11. In the Full name box, type Garrett Vargas.

  12. In the Description box, type Account used for the Model Security tutorial.

  13. In the Password box, type Pass12,Word.

  14. In the Confirm password box, type Pass12,Word.

  15. Clear the User must change password at next logon check box, and then click Create.

    Garrett1 is added to the list of users.

  16. Click Close.

    Next, you will give these users permissions to the report server.

To assign catalog roles to the new users

  1. To start Report Manager, start Microsoft Internet Explorer 6 or later.

  2. In the Address bar of the Web browser, type the Report Manager URL. By default, the URL is http://<ComputerName>/reports.

  3. Select the Properties tab.

  4. Click New Role Assignment.

    Note

    A role assignment specifies the tasks that the user or group can perform to an item on the report server.

  5. In the Group or user name box, type <computername>\Rachel0.

  6. Select the Browser and Report Builder check boxes.

  7. Click OK.

  8. Click New Role Assignment.

  9. In the Group or user name box, type <computername>\Garrett1.

  10. Select the Browser and Report Builder check boxes.

  11. Click OK.

To assign system roles to the new users

  1. In Report Manager, click Site Settings on the global toolbar.

    The Site Settings page appears.

    Note

    If Site Settings is not available, you do not have permission to access site settings and need to contact your administrator.

  2. In the Security section, click Configure site-wide security.

  3. Click New Role Assignment.

  4. In the Group or user name box, type <computername>\Rachel0.

  5. Select the System User check box.

    Note

    The system role gives the user or group access to Report Manager. The roles describe the tasks or actions that can be performed.

  6. Click OK.

  7. Click New Role Assignment.

  8. In the Group or user name box, type <computername>\Garrett1.

  9. Select the System User check box.

  10. Click OK.

    The fictitious users that you created are now able to access items on the report server as well as log on to the computer on which the report server is running.

To start SQL Server Management Studio

  1. Point to Start, point to All Programs, point to Microsoft SQL Server 2005, and then click SQL Server Management Studio.

    The Connect to Server dialog box appears. If it does not, in Object Explorer, click Connect and then select Database Engine.

  2. In the Server type list, select Database Engine.

  3. In the Server name list, select the database server that you are using for this tutorial.

  4. Click Connect.

    The SQL Server Management Studio window opens. Next, you will create a login to the AdventureWorks database so that the model can use this fictitious login to access the database.

To create a security login

  1. In Object Explorer, expand the Security node for the server you specified.

  2. Right-click Logins and select New Login.

    The Login - New dialog box opens.

  3. In the Login name box, type TutorialLogin.

  4. Select the SQL Server authentication option.

  5. In the Password box, type Pass1word.

    Note

    To help keep your computer more secure, you should always use a strong password. A strong password should be at least seven characters long, and contain characters from the following three groups: Letters, Numerals, and Symbols. Also, make sure that you delete this Login after you have completed the tutorial.

  6. In the Confirm password box, type Pass1word.

  7. Select the Enforce password policy check box.

  8. Clear the Enforce password expiration check box.

  9. In the Default database drop-down list, select AdventureWorks.

  10. Click OK.

    The TutorialLogin is added to the Logins list. The fictitious users that you created earlier in the lesson will use this login to access the AdventureWorks database. Next, you need to assign db_datareader privileges to the login.

To create an AdventureWorks Security user

  1. In Object Explorer, expand the Databases node for the server you specified.

  2. Expand the database node for AdventureWorks.

  3. Double-click Security.

  4. Right-click Users and then click New User.

    The Database User - New dialog box opens.

  5. In the User name box, type TutorialLogin.

  6. In the Login name box, type TutorialLogin.

  7. In the Default schema box, type db_datareader.

  8. In the Database role membership area, select the db_datareader check box.

  9. Click OK.

    Next, you will open the report model sample in Business Intelligence Development Studio, create a new attribute, modify the data source login information to use the new login, and then deploy the model.

To open the report model sample

  1. Point to Start, point to All Programs, point to Microsoft SQL Server 2005, and then click Business Intelligence Development Studio.

  2. On the File menu, point to Open, and then click Project/Solution.

  3. In the Open Project dialog box, navigate to the location where you installed the SQL Server 2005 samples. By default, the samples are installed in the following location: C:\Program Files\Microsoft SQL Server\90\Samples.

  4. Double-click Reporting Services.

  5. Double-click Model Samples.

  6. Double-click Adventure Works Model.

  7. Select Adventure Works Model.sln and then click Open.

  8. In Solution Explorer, double-click Adventure Works.smdl.

    The Adventure Works report model sample opens in Model Designer. Next, you will create a new expression that replaces the database login information with the login information you set up earlier in this lesson.

To create an attribute

  1. In Model Designer tree view, right-click the Employee entity, point to New, and then click Expression.

    The Define Formula dialog box opens.

  2. Click the Functions tab and then expand the Text functions node.

  3. Double-click the Replace function.

    The function is added to the formula box.

  4. Click the Fields tab.

  5. In the Fields list, double-click Login ID.

    In the formula box, find is replaced with Login ID.

  6. In the formula box, select replace and then type "adventure-works".

    Note

    Adventure-Works is the login information that you need to replace. Make sure to include the double-quotes.

  7. In the formula box, select string and then type "ComputerName".

    Note

    This is the name of the computer that you used to set up accounts for Rachel0 and Garrett1. Make sure to include the double-quotes. Your expression should appear as: REPLACE(Login_ID, "adventure-works", "<computername>").

  8. Click OK.

    The Define Formula dialog box closes.

  9. Right-click the NewExpression attribute, click Rename, and then type Login ID2.

    You will use this new attribute when applying your row-level security filter in the next lesson.

  10. Select Login ID2.

  11. In the Properties pane, locate the Nullable property.

  12. Click the drop-down arrow and select True.

    The Replace function can return Null; therefore, the Nullable property must be True.

To modify the data source connection

  1. In Solution Explorer, double-click the Adventure Works.ds file.

    The Data Source Designer dialog box opens.

  2. Click Edit.

    The Connection Manager dialog box opens.

  3. Select the Use SQL Server Authentication option.

  4. In the User name box, type TutorialLogin.

  5. In the Password box, type Pass1word.

  6. To verify the connection, click Test Connection.

  7. Click OK and then click OK again.

  8. To exit the Data Source Designer dialog box, click OK.

    The report model can now be deployed.

  9. On the File menu, click Save All.

    Note

    If you already have an Adventure Works.ds file deployed to the report server, the credentials will not be updated unless you change the default property. To change the default property, right-click the Adventure Works Model project and select Properties. In the Adventure Works Model Property Pages dialog box, click the OverwriteDataSources drop-down list and select True.

To deploy the report model sample

  • In Solution Explorer, right-click the Adventure Works Model project and then click Deploy.

    The model is deployed to the report server. Leave Business Intelligence Development Studio open with the model displayed.

    Important

    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.

Next Steps

The user accounts, permissions and customized login are now set up on your computer so that you can successfully complete this tutorial. You have created two fictitious users and assigned them the appropriate catalog and system role permissions on the report server. You have deployed the report model sample, and created a customized login which the model will use to read the AdventureWorks database. Later, you will use this fictitious user to assign row-level security.

Important

After completing this tutorial, remember to remove these user accounts from the local computer and remove all permissions that you have granted.

In the next lesson, you will open the Adventure Works report model sample and create a default security filter in Model Designer. See Lesson 2: Creating Attributes for Row-Level Security.

See Also

Other Resources

Creating, Modifying, and Deleting Role Assignments
Role Assignments
Report Manager
Setting System-Level Security
Installing Samples
SQL Server Reporting Services Samples
GETUSERID (Report Builder)

Help and Information

Getting SQL Server 2005 Assistance