PrincipalPermission.IsSubsetOf(IPermission) メソッド


現在のアクセス許可が、指定したアクセス許可のサブセットであるかどうかを判断します。Determines whether the current permission is a subset of the specified permission.

 virtual bool IsSubsetOf(System::Security::IPermission ^ target);
public bool IsSubsetOf (System.Security.IPermission target);
abstract member IsSubsetOf : System.Security.IPermission -> bool
override this.IsSubsetOf : System.Security.IPermission -> bool
Public Function IsSubsetOf (target As IPermission) As Boolean



サブセットの関係にあるかどうかをテストするアクセス許可。A permission that is to be tested for the subset relationship. このアクセス許可は、現在のアクセス許可と同じ型であることが必要です。This permission must be of the same type as the current permission.


現在のアクセス許可が、指定したアクセス許可のサブセットの場合は true。それ以外の場合は falsetrue if the current permission is a subset of the specified permission; otherwise, false.



target パラメーターは現在のアクセス許可と同じ型ではないオブジェクトです。The target parameter is an object that is not of the same type as the current permission.

次の例では、3つの異なるユーザーに対応する PrincipalPermission のインスタンスを定義します。The following example defines instances of PrincipalPermission corresponding to three distinct users. その後、2つのインスタンスがユーザーのグループとして作成されます。Two additional instances are then created as groups of users. pp1 は Bob と Louise を表し、pp2 Bob、Louise、および Greg を表します。pp1 represents Bob and Louise, pp2 represents Bob, Louise, and Greg.

//Define users and roles.
PrincipalPermission^ ppBob = gcnew PrincipalPermission( "Bob", "Manager" );
PrincipalPermission^ ppLouise = gcnew PrincipalPermission( "Louise", "Supervisor" );
PrincipalPermission^ ppGreg = gcnew PrincipalPermission( "Greg", "Employee" );

//Define groups of users.
PrincipalPermission^ pp1 = (PrincipalPermission^) (ppBob->Union( ppLouise ));
PrincipalPermission^ pp2 = (PrincipalPermission^) (ppGreg->Union( pp1 ));
//Define users and roles.
PrincipalPermission ppBob = new PrincipalPermission("Bob", "Manager");
PrincipalPermission ppLouise = new PrincipalPermission("Louise", "Supervisor");
PrincipalPermission ppGreg = new PrincipalPermission("Greg", "Employee");

//Define groups of users.
PrincipalPermission pp1 = (PrincipalPermission)ppBob.Union(ppLouise);
PrincipalPermission pp2 = (PrincipalPermission)ppGreg.Union(pp1);
'Define users and roles.
Dim ppBob As New PrincipalPermission("Bob", "Manager")
Dim ppLouise As New PrincipalPermission("Louise", "Supervisor")
Dim ppGreg As New PrincipalPermission("Greg", "Employee")
'Define groups of users.
Dim pp1 As PrincipalPermission = _
   CType(ppBob.Union(ppLouise), PrincipalPermission)
Dim pp2 As PrincipalPermission = _
   CType(ppGreg.Union(pp1), PrincipalPermission)

上記の宣言では、pp1.IsSubsetOf(pp2)trueを返し、pp2.IsSubsetOf(pp1)falseを返します。With the preceding declarations, pp1.IsSubsetOf(pp2) returns true, and pp2.IsSubsetOf(pp1) returns false.


現在のアクセス許可に対して成功したすべての要求も、指定したアクセス許可に対して成功した場合、現在のアクセス許可は、指定したアクセス許可のサブセットになります。The current permission is a subset of the specified permission if all demands that succeed for the current permission also succeed for the specified permission.