tailieunhanh - Beginning SQL Server Modeling- P11

Tham khảo tài liệu 'beginning sql server modeling- p11', công nghệ thông tin, cơ sở dữ liệu phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | CHAPTER 7 SQL SERVER MODELING SERVICES - SECURITY Figure 7-50. Granting the Select permission for each QC user Testing Now you should be in a position to test what data is exposed to each user. You can do this in the SQL Server Modeling Command Prompt window by impersonating a user with the runas command. Bring up the SQL Server Command Prompt window and execute the following code runas user CarQC y25 The y25 switch on the command is required and sets the display width for the SQLCMD prompt window. The system will prompt for the CarQC user s password which should be the same as the user name see Figure 7-51 . After that is accepted a separate SQLCMD window will appear where you can run SQL queries as the CarQC user against the MfgComponents view. 201 Download from Wow eBook CHAPTER 7 SQL SERVER MODELING SERVICES - SECURITY Figure 7-51. Using the runas command to impersonate the CarQC user opening a SQLCMD window In the SQLCMD window that comes up you re now running as the CarQC user. Enter the following SQL code see Figure 7-52 use Repository g The system should present the following message Changed database context to Repository . Next enter the following SQL commands select Name Level Folder from MfgComponentModel . MfgComponents go Now you might expect to see a listing of only the Car line components since it is the CarQC user who entered the query. But instead you get this The SELECT permission was denied on the object ReadableFoldersView database Repository schema . shown in Figure 7-52 . Figure 7-52. Permission denied to ReadableFoldersView I forgot intentionally to set up user access to ReadableFoldersView. I wanted you to see the type of error message that occurs in this situation. SQL Server gives detailed error messages when a permissions error occurs so instead of seeing something like Access denied - error code 229 you see exactly what permission is being denied and what object database and schema .

TỪ KHÓA LIÊN QUAN