Location My.User.IsInRole Syntax Dim result As Boolean = My.User.IsInRole(role) or Dim result As Boolean = My.User.IsInRole(builtInRole) role (required in syntax 1; String) The role against which the user will be compared for inclusion. builtInRole (required in syntax 2; BuiltInRole enumeration) The predefined role against which the user will be compared for inclusion. One of the following Microsoft.VisualBasic.ApplicationServices.BuiltInRole enumeration values. Value | Description |
|---|
AccountOperator | Users who manage local or domain user accounts | Administrator | Users who have full access to local or domain resources | BackupOperator | Users who back up local or domain files and require temporary yet extensive access | Guest | Users with minimal security access | PowerUser | Users with sufficient understanding of the local or domain environment to warrant enhanced security but not at the level of an administrator | PrintOperator | Users who control or manage the printers | Replicator | Users who control or manage file replication in a domain | SystemOperator | Users who have operational control over a local computer | User | Ordinary users with access to specific resources as assigned by an administrator | Description The IsInRole method indicates whether the current user belongs to the indicated role (true) or not (False). The function accepts a predefined member of the BuiltInRole enumeration or a String with the name of a role. Usage at a Glance If the current user is using a non-Windows authentication method and the BuiltInRole enumeration syntax of this method is used, the final part of the enumeration name is converted into a string, and that text is used as a lookup, as if the String syntax of this method had been called instead. Related Framework Entries Microsoft.VisualBasic.ApplicationServices.BuiltInRole Enumeration Microsoft.VisualBasic.ApplicationServices.User.IsInRole Method Microsoft.VisualBasic.ApplicationServices.WebUser.IsInRole Method System.Security.Principal.IPrincipal.IsInRole Method See Also CurrentPrincipal Property, InitializeWithWindowsUser Method, IsAuthenticated Property, Name Property (My.User), User Object |