Principal.IsMemberOf 方法
定义
返回一个布尔值,该值指定该组是否是指定组的成员。Returns a Boolean value that specifies whether the group is a member of the specified group.
重载
| IsMemberOf(PrincipalContext, IdentityType, String) |
返回一个布尔值,该值指定该主体是否是由标识类型和值指定的组的成员。Returns a Boolean value that specifies whether the principal is a member of the group specified by identity type and value. |
| IsMemberOf(GroupPrincipal) |
返回一个布尔值,该值指定该主体是否是指定组的成员。Returns a Boolean value that specifies whether the principal is a member of the specified group. |
IsMemberOf(PrincipalContext, IdentityType, String)
返回一个布尔值,该值指定该主体是否是由标识类型和值指定的组的成员。Returns a Boolean value that specifies whether the principal is a member of the group specified by identity type and value.
public:
bool IsMemberOf(System::DirectoryServices::AccountManagement::PrincipalContext ^ context, System::DirectoryServices::AccountManagement::IdentityType identityType, System::String ^ identityValue);
public bool IsMemberOf (System.DirectoryServices.AccountManagement.PrincipalContext context, System.DirectoryServices.AccountManagement.IdentityType identityType, string identityValue);
[System.Security.SecurityCritical]
public bool IsMemberOf (System.DirectoryServices.AccountManagement.PrincipalContext context, System.DirectoryServices.AccountManagement.IdentityType identityType, string identityValue);
member this.IsMemberOf : System.DirectoryServices.AccountManagement.PrincipalContext * System.DirectoryServices.AccountManagement.IdentityType * string -> bool
[<System.Security.SecurityCritical>]
member this.IsMemberOf : System.DirectoryServices.AccountManagement.PrincipalContext * System.DirectoryServices.AccountManagement.IdentityType * string -> bool
Public Function IsMemberOf (context As PrincipalContext, identityType As IdentityType, identityValue As String) As Boolean
参数
- context
- PrincipalContext
PrincipalContext,用于指定要对其执行操作的服务器或域。The PrincipalContext that specifies the server or domain against which operations are performed.
- identityType
- IdentityType
一个 IdentityType 枚举值,该值指定标识值的类型。A IdentityType enumeration value that specifies the type of the identity value.
- identityValue
- String
组的标识。The identity of the group.
返回
如果主体是指定组的成员,则为 true;否则为 false。true if the principal is a member of the specified group; otherwise false.
- 属性
例外
标识类型或值与 GroupPrincipal 不对应。The identity type or value does not correspond to a GroupPrincipal.
找到多个匹配的 GroupPrincipal。More than one matching GroupPrincipal was found.
注解
如果当前主体是 AD DS 主体,则返回的组包括主体的主要组,如 AD DS 对象上的主要组 ID 属性所示。If the current principal is an AD DS principal, the returned groups include the principal's primary group, as indicated by the primary group ID attribute on the AD DS object.
适用于
IsMemberOf(GroupPrincipal)
返回一个布尔值,该值指定该主体是否是指定组的成员。Returns a Boolean value that specifies whether the principal is a member of the specified group.
public:
bool IsMemberOf(System::DirectoryServices::AccountManagement::GroupPrincipal ^ group);
public bool IsMemberOf (System.DirectoryServices.AccountManagement.GroupPrincipal group);
[System.Security.SecurityCritical]
public bool IsMemberOf (System.DirectoryServices.AccountManagement.GroupPrincipal group);
member this.IsMemberOf : System.DirectoryServices.AccountManagement.GroupPrincipal -> bool
[<System.Security.SecurityCritical>]
member this.IsMemberOf : System.DirectoryServices.AccountManagement.GroupPrincipal -> bool
Public Function IsMemberOf (group As GroupPrincipal) As Boolean
参数
- group
- GroupPrincipal
为其确定主体成员资格的 GroupPrincipal 对象。The GroupPrincipal object for which principal membership is determined.
返回
如果主体是指定组的成员,则为 true;否则为 false。true if the principal is a member of the specified group; otherwise false.
- 属性
例外
未能找到在组参数中指定的 GroupPrincipal。The GroupPrincipal specified in the group parameter could not be found.
找到多个匹配的 GroupPrincipal。More than one matching GroupPrincipal was found.
注解
如果当前主体是 AD DS 主体,则返回的组包括主体的主要组,如 AD DS 对象上的主要组 ID 属性所示。If the current principal is an AD DS principal, the returned groups include the principal's primary group, as indicated by the primary group ID attribute on the AD DS object.