Class Permissions
- All Implemented Interfaces:
- Cloneable
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()).
 Note: This class isn't supported in Java 18 and higher where SecurityManager has been
 deprecated for removal.
- Since:
- Ant 1.6
- 
Nested Class SummaryNested Classes
- 
Field SummaryFields inherited from class org.apache.tools.ant.ProjectComponentdescription, location, project
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a set of Permissions.Permissions(boolean delegateToOldSM) Create a set of permissions.
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds a permission to be granted.voidAdds a permission to be revoked.voidTo be used by tasks that just finished executing the parts subject to these permissions.voidTo be used by tasks wishing to use this security model before executing the part to be subject to these Permissions.Methods inherited from class org.apache.tools.ant.ProjectComponentclone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
- 
Constructor Details- 
Permissionspublic Permissions()Create a set of Permissions. Equivalent to callingnew Permissions(false).
- 
Permissionspublic Permissions(boolean delegateToOldSM) Create a set of permissions.- Parameters:
- delegateToOldSM- if- truethe old security manager will be used if the permission has not been explicitly granted or revoked in this instance.
 
 
- 
- 
Method Details- 
addConfiguredGrantAdds a permission to be granted.- Parameters:
- perm- The Permissions.Permission to be granted.
 
- 
addConfiguredRevokeAdds a permission to be revoked.- Parameters:
- perm- The Permissions.Permission to be revoked
 
- 
setSecurityManagerTo 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.This method is no longer supported in Java 18 and higher versions and throws a BuildException.MagicNames.WARN_SECURITY_MANAGER_USAGEproperty can be set totrueto log a warning message instead of throwing the exception.- Throws:
- BuildException- on error
 
- 
restoreSecurityManagerTo be used by tasks that just finished executing the parts subject to these permissions.This method is no longer supported in Java 18 and higher versions and throws a BuildException.MagicNames.WARN_SECURITY_MANAGER_USAGEproperty can be set totrueto log a warning message instead of throwing the exception.- Throws:
- BuildException
 
 
-