Bagikan melalui


IAuthorizationExtension.CreateSecurityDescriptor Method

Definition

Returns the security descriptor that is stored with an individual item in the report server database.

public:
 cli::array <System::Byte> ^ CreateSecurityDescriptor(Microsoft::ReportingServices::Interfaces::AceCollection ^ acl, Microsoft::ReportingServices::Interfaces::SecurityItemType itemType, [Runtime::InteropServices::Out] System::String ^ % stringSecDesc);
public byte[] CreateSecurityDescriptor (Microsoft.ReportingServices.Interfaces.AceCollection acl, Microsoft.ReportingServices.Interfaces.SecurityItemType itemType, out string stringSecDesc);
abstract member CreateSecurityDescriptor : Microsoft.ReportingServices.Interfaces.AceCollection * Microsoft.ReportingServices.Interfaces.SecurityItemType * string -> byte[]
Public Function CreateSecurityDescriptor (acl As AceCollection, itemType As SecurityItemType, ByRef stringSecDesc As String) As Byte()

Parameters

acl
AceCollection

The access code list created by the report server for the item. It contains a collection of access code entries.

itemType
SecurityItemType

The type of item for which the security descriptor is created.

stringSecDesc
String

Optional. A user-friendly description of the security descriptor that can be used for debugging. This is not stored by the report server.

Returns

Byte[]

A serialized access code list.

Examples

The following example uses the CreateSecurityDescriptor method to serialize the access code list for an item in the report server database. You can use this method to serialize additional security or authentication information as part of the security descriptor.

Public Function CreateSecurityDescriptor(acl As AceCollection, itemType As SecurityItemType, ByRef stringSecDesc As String) As Byte()  
   ' Creates a memory stream and serializes the ACL for storage.  
   Dim bf As New BinaryFormatter()  
   Dim result As New MemoryStream()  
   bf.Serialize(result, acl)  
   stringSecDesc = Nothing  
   Return result.GetBuffer()  
End Function 'CreateSecurityDescriptor  
public byte[] CreateSecurityDescriptor(AceCollection acl, SecurityItemType itemType, out string stringSecDesc)  
{  
   // Creates a memory stream and serializes the ACL for storage.  
   BinaryFormatter bf = new BinaryFormatter();  
   MemoryStream result = new MemoryStream();  
   bf.Serialize(result, acl);  
   stringSecDesc = null;  
   return result.GetBuffer();  
}  

Remarks

Implement this method to serialize the access code list that is applied to an item in the report server database.

A security descriptor describes the following:

  • The group or user that has some type of permission to perform operations on the item.

  • The item's type.

  • A discretionary access control list controlling access to the item.

You can control access to an item and its properties using a security descriptor. Using a SQL Server Reporting Services security descriptor, you can:

  • Grant a trustee access rights to an item and its properties.

  • Identify trustees using a principal name or user ID.

  • Set, retrieve, and modify the descriptor programmatically.

Each item's security descriptor is created by a call to the CreateSecurityDescriptor method and accessed by a call to CheckAccess through the report server. This property is the item's descriptor in a serialized byte array. The descriptor is physically stored in the report server database, which is internally based on a collection of access control entries. When you request an access check on an item, the byte array is retrieved from the database and passed as an argument to the CheckAccess method. When you set this property for an item, the AceCollection is passed and you are required to create the binary descriptor for the item.

Applies to