Package org.apache.tools.ant.types

## Class Permissions

- java.lang.Object
- - org.apache.tools.ant.types.Permissions

-     public class Permissions
      extends java.lang.Object

  This class implements a security manager meant for usage by tasks that run inside the Ant VM. An examples are the Java Task and JUnitTask. The basic functionality is that nothing (except for a base set of permissions) is allowed, unless the permission is granted either explicitly or implicitly. If a permission is granted this can be overruled by explicitly revoking the permission. It is not permissible to add permissions (either granted or revoked) while the Security Manager is active (after calling setSecurityManager() but before calling restoreSecurityManager()).
  Since:
    Ant 1.6

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `Permissions.Permission` | Represents a permission.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Permissions()` | Create a set of Permissions.
    `Permissions​(boolean delegateToOldSM)` | Create a set of permissions.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addConfiguredGrant​(Permissions.Permission perm)` | Adds a permission to be granted.
    `void` | `addConfiguredRevoke​(Permissions.Permission perm)` | Adds a permission to be revoked.
    `void` | `restoreSecurityManager()` | To be used by tasks that just finished executing the parts subject to these permissions.
    `void` | `setSecurityManager()` | To be used by tasks wishing to use this security model before executing the part to be subject to these Permissions.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Permissions

          public Permissions()

      Create a set of Permissions. Equivalent to calling `new Permissions(false)`.

    - #### Permissions

          public Permissions​(boolean delegateToOldSM)

      Create a set of permissions.
      Parameters:
        `delegateToOldSM` - if `true` the old security manager will be used if the permission has not been explicitly granted or revoked in this instance.

  - ### Method Detail

    - #### addConfiguredGrant

          public void addConfiguredGrant​(Permissions.Permission perm)

      Adds a permission to be granted.
      Parameters:
        `perm` - The Permissions.Permission to be granted.

    - #### addConfiguredRevoke

          public void addConfiguredRevoke​(Permissions.Permission perm)

      Adds a permission to be revoked.
      Parameters:
        `perm` - The Permissions.Permission to be revoked

    - #### setSecurityManager

          public void setSecurityManager()
                                  throws BuildException

      To be used by tasks wishing to use this security model before executing the part to be subject to these Permissions. Note that setting the SecurityManager too early may prevent your part from starting, as for instance changing classloaders may be prohibited. The classloader for the new situation is supposed to be present.
      Throws:
        `BuildException` - on error

    - #### restoreSecurityManager

          public void restoreSecurityManager()

      To be used by tasks that just finished executing the parts subject to these permissions.