Redigera

Dela via


RoleGroup.ContainsUser(IPrincipal) Method

Definition

Indicates whether the specified user is a member of any of the roles in the role group.

public:
 bool ContainsUser(System::Security::Principal::IPrincipal ^ user);
public bool ContainsUser (System.Security.Principal.IPrincipal user);
member this.ContainsUser : System.Security.Principal.IPrincipal -> bool
Public Function ContainsUser (user As IPrincipal) As Boolean

Parameters

user
IPrincipal

The user name to look for in the role group.

Returns

true if the user is a member of one of the roles associated with this role group; otherwise, false.

Exceptions

User is null.

Remarks

The ContainsUser method returns true if the specified user is a member of any of the roles associated with this role group. Roles are searched in the order they are listed in the Roles property, and searching stops after the first match is found.

This method uses the IsUserInRole method to determine whether a user is a member of a role. You must configure role management to use the ContainsUser method. For more information, see Understanding Role Management.

Applies to

See also