PermissionSet.SetPermission(IPermission) PermissionSet.SetPermission(IPermission) PermissionSet.SetPermission(IPermission) PermissionSet.SetPermission(IPermission) Method

定義

PermissionSet にアクセス許可を設定し、同じ種類のすべての既存のアクセス権を置換します。Sets a permission to the PermissionSet, replacing any existing permission of the same type.

public:
 System::Security::IPermission ^ SetPermission(System::Security::IPermission ^ perm);
public System.Security.IPermission SetPermission (System.Security.IPermission perm);
member this.SetPermission : System.Security.IPermission -> System.Security.IPermission
Public Function SetPermission (perm As IPermission) As IPermission

パラメーター

perm
IPermission IPermission IPermission IPermission

設定するアクセス許可。The permission to set.

戻り値

設定されたアクセス許可。The set permission.

例外

次のコード例の使用を示しています、SetPermissionメソッド。The following code example shows the use of the SetPermission method. このコード例が示されている例の一部、PermissionSetクラス。This code example is part of a larger example provided for the PermissionSet class.

// Change the permission set using SetPermission.
ps5->SetPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::AllAccess,"USERNAME" ) );
Console::WriteLine( "Permission set after SetPermission = {0}", ps5 );
// Change the permission set using SetPermission.
ps5.SetPermission(new EnvironmentPermission(EnvironmentPermissionAccess.AllAccess, "USERNAME"));
Console.WriteLine("Permission set after SetPermission = " + ps5.ToString());
' Change the permission set using SetPermission.
ps5.SetPermission(New EnvironmentPermission(EnvironmentPermissionAccess.AllAccess, "USERNAME"))
Console.WriteLine("Permission set after SetPermission = " & ps5.ToString())

注釈

このメソッドから同じ型の既存のアクセス許可オブジェクトを削除、PermissionSetで置き換えて、permパラメーター。This method removes any existing permission object of the same type from the PermissionSet and replaces it with the perm parameter. アクセス許可を実装する場合IUnrestrictedPermissionが設定されて、PermissionSetつまりUnrestricted、結果のPermissionSetが不要になったUnrestrictedIf a permission that implements IUnrestrictedPermission is set on a PermissionSet that is Unrestricted, the resulting PermissionSet is no longer Unrestricted.

注意 (継承者)

継承する場合PermissionSetの動作を変更することができます、SetPermission(IPermission)メソッドをオーバーライドすることで、SetPermissionImpl(IPermission)メソッド。When you inherit from PermissionSet, you can change the behavior of the SetPermission(IPermission) method by overriding the SetPermissionImpl(IPermission) method.

適用対象