Managing Permissions in SQL Server 2008 R2

 

 

Database safety is primarily around managing permissions. Permissions are the security instruments that tie principals (As an example, logins) to object (As an example, tables). With SQL Server 2008, authorizations can be applied at a granulated level that delivers a great deal of elasticity and control. Permissions in SQL Server 2008 revolve about three commands: GRANT, REVOKE, and DENY. These three commands remained also used in SQL Server 2005 and SQL Server 2000. When permission is granted, the user or role is given permission to execute an action, such as creating a table. The DENY statement denies permission on an object and avoids the principal from gaining GRANT permission based on association in a group or role. The REVOKE statement eliminates a permission that was previously granted or denied. When stipulating permissions, you need to prudently consider the hierarchy that exists among GRANT, REVOKE, and DENY. This is mainly important when the principal (As an example, user or login) is part of a collection or role and permissions have been granted on objects at diverse scopes of the security model. Following are some examples of the priority that exists between these statements:

 

The consignment of a permission includes the GRANT, DENY, or REVOKE declarations plus the permission that these statements affect. The number of accessible permissions increased in SQL Server 2005 and has been carried onward to SQL Server 2008. Accustomed permissions such as EXECUTE, INSERT, and SELECT that were accessible in SQL Server 2000 are still around, plus the new permissions that were added in SQL Server 2005. Subsequent are some of the new types that were added in SQL Server 2005:

 

You can also view the accessible permissions by using system functions and catalog views. The subsequent example uses the sys .fn_builtin_permissions function to rescue a partial listing of all the available permissions:

SELECT top 5 class_desc, permission_name, parent_class_desc
FROM sys.fn_builtin_permissions(default)
order by 1,2
/* Results from previous query
class_desc permission_name parent_class_desc
APPLICATION ROLE
APPLICATION ROLE
APPLICATION ROLE
ASSEMBLY
ASSEMBLY
*/
ALTER DATABASE
CONTROL DATABASE
VIEW DEFINITION DATABASE
ALTER DATABASE

CONTROL DATABASE

 

The granularity with which permissions can be applied with SQL Server 2008 is inspiring and, to some degree, exciting. When you look at all the available permissions, you will see that some preparation is needed to manage them. In the past, fixed database roles were humble to use but in many cases provided permissions that went outside what the user needed. MS has supplied the tools to facilitate the concept of "least privileges," which means providing only the privileges that are needed and nothing more.