Freigeben über


TeamFoundationSecurityNamespace.HasPermission Method (TeamFoundationRequestContext, String, Int32, Boolean, PermissionEvaluationCallback)

First checks to see whether the request context making the call is a SystemRequestContext and if it is, it returns true immediately. Next, it queries the underlying permission store to determine whether the requestContext.UserContext has the requested permissions on this token. If alwaysAllowAdministrators is true and the UserContext is an admin on this server, the user will have permissions regardless of what the permission evaluation says. If the UserContext does not have the requestedPermissions, false will be returned.

Namespace:  Microsoft.TeamFoundation.Framework.Server
Assembly:  Microsoft.TeamFoundation.Framework.Server (in Microsoft.TeamFoundation.Framework.Server.dll)

Syntax

'Declaration
Public Overridable Function HasPermission ( _
    requestContext As TeamFoundationRequestContext, _
    token As String, _
    requestedPermissions As Integer, _
    alwaysAllowAdministrators As Boolean, _
    permissionEvaluationCallback As PermissionEvaluationCallback _
) As Boolean
public virtual bool HasPermission(
    TeamFoundationRequestContext requestContext,
    string token,
    int requestedPermissions,
    bool alwaysAllowAdministrators,
    PermissionEvaluationCallback permissionEvaluationCallback
)
public:
virtual bool HasPermission(
    TeamFoundationRequestContext^ requestContext, 
    String^ token, 
    int requestedPermissions, 
    bool alwaysAllowAdministrators, 
    PermissionEvaluationCallback^ permissionEvaluationCallback
)
abstract HasPermission : 
        requestContext:TeamFoundationRequestContext * 
        token:string * 
        requestedPermissions:int * 
        alwaysAllowAdministrators:bool * 
        permissionEvaluationCallback:PermissionEvaluationCallback -> bool  
override HasPermission : 
        requestContext:TeamFoundationRequestContext * 
        token:string * 
        requestedPermissions:int * 
        alwaysAllowAdministrators:bool * 
        permissionEvaluationCallback:PermissionEvaluationCallback -> bool
public function HasPermission(
    requestContext : TeamFoundationRequestContext, 
    token : String, 
    requestedPermissions : int, 
    alwaysAllowAdministrators : boolean, 
    permissionEvaluationCallback : PermissionEvaluationCallback
) : boolean

Parameters

  • token
    Type: System.String

    The token the permissions are being checked on.

  • requestedPermissions
    Type: System.Int32

    The permissions to check for.

  • alwaysAllowAdministrators
    Type: System.Boolean

    If true and the UserContext is in the administrators group, the user will have permission regardless of what the permission evaluation says.

Return Value

Type: System.Boolean
True if the UserContext has permission, false otherwise.

.NET Framework Security

See Also

Reference

TeamFoundationSecurityNamespace Class

HasPermission Overload

Microsoft.TeamFoundation.Framework.Server Namespace