Table of Contents

Class SecuritySchema.DatabasePermission

Namespace
LinqToDB.Tools.DataProvider.SqlServer.Schemas
Assembly
linq2db.Tools.dll

sys.database_permissions (Transact-SQL)

Applies to: √ SQL Server (all supported versions) √ Azure SQL Database √ Azure SQL Managed Instance √ Azure Synapse Analytics √ Analytics Platform System (PDW)

Returns a row for every permission or column-exception permission in the database. For columns, there is a row for every permission that is different from the corresponding object-level permission. If the column permission is the same as the corresponding object permission, there is no row for it and the permission applied is that of the object.

important


Column-level permissions override object-level permissions on the same entity.


See sys.database_permissions.

[Table(Schema = "sys", Name = "database_permissions", IsView = true)]
public class SecuritySchema.DatabasePermission
Inheritance
SecuritySchema.DatabasePermission
Extension Methods

Properties

Class

Identifies class on which permission exists. For more information, see sys.securable_classes (Transact-SQL).

0 = Database
1 = Object or Column
3 = Schema
4 = Database Principal
5 = Assembly - Applies to: SQL Server 2008 and later.
6 = Type
10 = XML Schema Collection -
Applies to: SQL Server 2008 and later.
15 = Message Type - Applies to: SQL Server 2008 and later.
16 = Service Contract - Applies to: SQL Server 2008 and later.
17 = Service - Applies to: SQL Server 2008 and later.
18 = Remote Service Binding - Applies to: SQL Server 2008 and later.
19 = Route - Applies to: SQL Server 2008 and later.
23 =Full-Text Catalog - Applies to: SQL Server 2008 and later.
24 = Symmetric Key - Applies to: SQL Server 2008 and later.
25 = Certificate - Applies to: SQL Server 2008 and later.
26 = Asymmetric Key - Applies to: SQL Server 2008 and later.
29 = Fulltext Stoplist - Applies to: SQL Server 2008 and later.
31 = Search Property List - Applies to: SQL Server 2008 and later.
32 = Database Scoped Credential - Applies to: SQL Server 2008 and later.
34 = External Language - Applies to: SQL Server 2008 and later.

[Column("class")]
[NotNull]
public byte Class { get; set; }

Property Value

byte

ClassDesc

Description of class on which permission exists.

DATABASE

OBJECT_OR_COLUMN

SCHEMA

DATABASE_PRINCIPAL

ASSEMBLY

TYPE

XML_SCHEMA_COLLECTION

MESSAGE_TYPE

SERVICE_CONTRACT

SERVICE

REMOTE_SERVICE_BINDING

ROUTE

FULLTEXT_CATALOG

SYMMETRIC_KEYS

CERTIFICATE

ASYMMETRIC_KEY

FULLTEXT STOPLIST

SEARCH PROPERTY LIST

DATABASE SCOPED CREDENTIAL

EXTERNAL LANGUAGE

[Column("class_desc")]
[Nullable]
public string? ClassDesc { get; set; }

Property Value

string

GranteePrincipalID

Database principal ID to which the permissions are granted.

[Column("grantee_principal_id")]
[NotNull]
public int GranteePrincipalID { get; set; }

Property Value

int

GrantorPrincipalID

Database principal ID of the grantor of these permissions.

[Column("grantor_principal_id")]
[NotNull]
public int GrantorPrincipalID { get; set; }

Property Value

int

MajorID

ID of thing on which permission exists, interpreted according to class. Usually, the major_id is simply the kind of ID that applies to what the class represents.

0 = The database itself

>0 = Object-IDs for user objects

<0 = Object-IDs for system objects

[Column("major_id")]
[NotNull]
public int MajorID { get; set; }

Property Value

int

MinorID

Secondary-ID of thing on which permission exists, interpreted according to class. Often, the minor_id is zero, because there is no subcategory available for the class of object. Otherwise, it is the Column-ID of a table.

[Column("minor_id")]
[NotNull]
public int MinorID { get; set; }

Property Value

int

PermissionName

Permission name.

[Column("permission_name")]
[Nullable]
public string? PermissionName { get; set; }

Property Value

string

State

Permission state:

D = Deny

R = Revoke

G = Grant

W = Grant With Grant Option

[Column("state")]
[NotNull]
public string State { get; set; }

Property Value

string

StateDesc

Description of permission state:

DENY

REVOKE

GRANT

GRANT_WITH_GRANT_OPTION

[Column("state_desc")]
[Nullable]
public string? StateDesc { get; set; }

Property Value

string

TypeColumn

Database permission type. For a list of permission types, see the next table.

[Column("type")]
[NotNull]
public string TypeColumn { get; set; }

Property Value

string