Microsoft SDK for Java

revertPermission

This method of the PolicyEngine Class negates the effects of any assertions (assertPermission) or denials (denyPermission) that have been performed for the specified permission type by the current stack frame.

Syntax

public static native void revertPermission(PermissionID pid);

Parameters

pid The type of permission to revert.

The following example asserts a right, and then reverts it:

   ...

   // Assert your rights to perform file I/O operations

   PolicyEngine.assertPermission(PermissionID.FILEIO);

   // Do some file I/O. Your callers will be ignored during
   // the file I/O security check that this operation causes
   // because you have asserted your rights.

   FileInputStream fis = new FileInputStream("c:\\MySample.txt");

   // Remove the file I/O assertion.

   PolicyEngine.revertPermission(PermissionID.FILEIO);

   // Do some more file I/O. This time your callers will be
   // included in the security check since
   // your file I/O rights are no longer asserted.

   FileInputStream fis = new FileInputStream("c:\\MySample.txt");
   ...

See Also

assertPermission, denyPermission

© 1999 Microsoft Corporation. All rights reserved. Terms of use.