INF: How Grant and Revoke work in SQL Server 6.5.Last reviewed: April 9, 1997Article ID: Q154422 |
The information in this article applies to:
SUMMARYIn SQL Server version 6.5, the implementation of permissions has changed compared to previous versions. This article describes the SQL Server 6.5 behavior.
MORE INFORMATIONThe Sysprotects table maintains information about user and group permissions. A change in SQL Server 6.5 from the previous version is how it writes to the Sysprotects table, which in turn affects what permission is assigned to a user or to a group. SQL Server determines what to write to the Sysprotects table based on the current content of the table. SQL Server evaluates whether a row exists in the Sysprotects table for the specific permission, action, object, and user or group. If a row exists in Sysprotects relating to the specific permission, SQL Server performs one of the following steps:
The following example displays the behavior mentioned above. In the example, user1 is a user and group1 is a group which contains user1. Step 1: Grant permission to a user. This will enter a row with GRANT in Sysprotects.GRANT select ON authors_test TO user1 go sp_helprotect authors_test go Result:
Owner Object Grantee Grantor ProtectType Action Column----- ------------ ------- ------- ----------- ------ --------- dbo authors_test user1 dbo Grant Select (All+New)Step 2: Issue another GRANT statement to group1. This enters another row in Sysprotects.GRANT select ON authors_test TO group1 go sp_helprotect authors_test go Result:
Owner Object Grantee Grantor ProtectType Action Column----- ------------ ------- ------- ----------- ------ --------- dbo authors_test user1 dbo Grant Select (All+New) dbo authors_test group1 dbo Grant Select (All+New)Step 3: REVOKE permission from group1, which cancels the previously assigned GRANT to group1 and only the one row with GRANT to user1 is left in Sysprotects.REVOKE select ON authors_test FROM group1 go sp_helprotect authors_test go Result:
Owner Object Grantee Grantor ProtectType Action Column----- ------------ ------- ------- ----------- ------ --------- dbo authors_test user1 dbo Grant Select (All+New)Step 4: Issue a REVOKE from either group1 or public. This does not place any entry in Sysprotects.REVOKE select ON authors_test FROM group1 go sp_helprotect authors_test go Result:
Owner Object Grantee Grantor ProtectType Action Column----- ------------ ------- ------- ----------- ------ --------- dbo authors_test user1 dbo Grant Select (All+New)Step 5: Issue a GRANT to public and then a REVOKE from group1. This enters two more entries in Sysprotects.GRANT select ON authors_test TO public go REVOKE select ON authors_test FROM group1 go sp_helprotect authors_test go Result:
Owner Object Grantee Grantor ProtectType Action Column----- ------------ ------- ------- ----------- ------ --------- dbo authors_test user1 dbo Grant Select (All+New) dbo authors_test group1 dbo Revoke Select (All+New) dbo authors_test public dbo Grant Select (All+New)Step 6: Issue a GRANT to group1. This removes the existing REVOKE permission from group1 and adds a new entry for GRANT permission to group1.GRANT select ON authors_test TO group1 go sp_helprotect authors_test go Result:
Owner Object Grantee Grantor ProtectType Action Column----- ------------ ------- ------- ----------- ------ --------- dbo authors_test user1 dbo Grant Select (All+New) dbo authors_test group1 dbo Grant Select (All+New) dbo authors_test public dbo Grant Select (All+New) |
Additional query words: sql
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |