TeamFoundationSecurityNamespace.HasPermission Method (TeamFoundationRequestContext, IEnumerable<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 the tokens. 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 Function HasPermission ( _
requestContext As TeamFoundationRequestContext, _
tokens As IEnumerable(Of String), _
requestedPermissions As Integer, _
alwaysAllowAdministrators As Boolean, _
permissionEvaluationCallback As PermissionEvaluationCallback _
) As IEnumerable(Of Boolean)
public IEnumerable<bool> HasPermission(
TeamFoundationRequestContext requestContext,
IEnumerable<string> tokens,
int requestedPermissions,
bool alwaysAllowAdministrators,
PermissionEvaluationCallback permissionEvaluationCallback
)
public:
IEnumerable<bool>^ HasPermission(
TeamFoundationRequestContext^ requestContext,
IEnumerable<String^>^ tokens,
int requestedPermissions,
bool alwaysAllowAdministrators,
PermissionEvaluationCallback^ permissionEvaluationCallback
)
member HasPermission :
requestContext:TeamFoundationRequestContext *
tokens:IEnumerable<string> *
requestedPermissions:int *
alwaysAllowAdministrators:bool *
permissionEvaluationCallback:PermissionEvaluationCallback -> IEnumerable<bool>
public function HasPermission(
requestContext : TeamFoundationRequestContext,
tokens : IEnumerable<String>,
requestedPermissions : int,
alwaysAllowAdministrators : boolean,
permissionEvaluationCallback : PermissionEvaluationCallback
) : IEnumerable<boolean>
Parameters
requestContext
Type: Microsoft.TeamFoundation.Framework.Server.TeamFoundationRequestContextThe request context associated with this call.
tokens
Type: System.Collections.Generic.IEnumerable<String>The tokens the permissions are being checked on.
requestedPermissions
Type: System.Int32The permissions to check for.
alwaysAllowAdministrators
Type: System.BooleanIf true and the UserContext is in the administrators group, the user will have permission regardless of what the permission evaluation says.
permissionEvaluationCallback
Type: Microsoft.TeamFoundation.Framework.Server.PermissionEvaluationCallbackThe permission evaluation callback that will be fired every time that a permission decision is being made. Nothing will be fired if this value is null.
Return Value
Type: System.Collections.Generic.IEnumerable<Boolean>
An enumeration of the results for the user for each token. These will be returned in the order that the tokens were passed in.
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.