Partager via


Méthode CheckAccess (String, IntPtr, Byte[], FolderOperation[])

Checks a user's authorization credentials against a security descriptor for operations on an item in the report server database

Espace de noms :  Microsoft.ReportingServices.Interfaces
Assemblys :   Microsoft.ReportingServices.SharePoint.UI.WebParts (en Microsoft.ReportingServices.SharePoint.UI.WebParts.dll)
  Microsoft.ReportingServices.Interfaces (en Microsoft.ReportingServices.Interfaces.dll)

Syntaxe

'Déclaration
<StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey := "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")> _
Function CheckAccess ( _
    userName As String, _
    userToken As IntPtr, _
    secDesc As Byte(), _
    requiredOperations As FolderOperation() _
) As Boolean
'Utilisation
Dim instance As IAuthorizationExtension
Dim userName As String
Dim userToken As IntPtr
Dim secDesc As Byte()
Dim requiredOperations As FolderOperation()
Dim returnValue As Boolean

returnValue = instance.CheckAccess(userName, _
    userToken, secDesc, requiredOperations)
[StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey = "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")]
bool CheckAccess(
    string userName,
    IntPtr userToken,
    byte[] secDesc,
    FolderOperation[] requiredOperations
)
[StrongNameIdentityPermissionAttribute(SecurityAction::LinkDemand, PublicKey = L"0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")]
bool CheckAccess(
    String^ userName, 
    IntPtr userToken, 
    array<unsigned char>^ secDesc, 
    array<FolderOperation>^ requiredOperations
)
[<StrongNameIdentityPermissionAttribute(SecurityAction.LinkDemand, PublicKey = "0024000004800000940000000602000000240000525341310004000001000100272736ad6e5f9586bac2d531eabc3acc666c2f8ec879fa94f8f7b0327d2ff2ed523448f83c3d5c5dd2dfc7bc99c5286b2c125117bf5cbe242b9d41750732b2bdffe649c6efb8e5526d526fdd130095ecdb7bf210809c6cdad8824faa9ac0310ac3cba2aa0523567b2dfa7fe250b30facbd62d4ec99b94ac47c7d3b28f1f6e4c8")>]
abstract CheckAccess : 
        userName:string * 
        userToken:IntPtr * 
        secDesc:byte[] * 
        requiredOperations:FolderOperation[] -> bool 
function CheckAccess(
    userName : String, 
    userToken : IntPtr, 
    secDesc : byte[], 
    requiredOperations : FolderOperation[]
) : boolean

Paramètres

  • userToken
    Type : System. . :: . .IntPtr
    A user account token. This token is primarily used by the report server as a handle to a Microsoft Windows account in support of credential management for Windows Authentication.

Valeur de retour

Type : System. . :: . .Boolean
Returns true if the currently authenticated user is granted access to the item based on the supplied operation and security descriptor.

Exemples

The following example code uses the CheckAccess method to evaluate a user's authorization credentials against a security descriptor for an item in the report server database. The example makes use of the overloaded CheckAccess method that takes a single operation as an argument.

' Overload for array of folder operations
Public Function CheckAccess(userName As String, userToken As IntPtr, secDesc() As Byte, requiredOperations() As FolderOperation) As Boolean
   Dim operation As FolderOperation
   For Each operation In  requiredOperations
      If Not CheckAccess(userName, userToken, secDesc, operation) Then
         Return False
      End If
   Next operation
   Return True
End Function 'CheckAccess
// Overload for array of folder operations
public bool CheckAccess(string userName, IntPtr userToken, byte[] secDesc, FolderOperation[] requiredOperations)
{
   foreach(FolderOperation operation in requiredOperations)
   {
      if (!CheckAccess(userName, userToken, secDesc, operation))
         return false;
   }
   return true; 
}