public class Permissions extends ProjectComponent
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.
Modifier and Type | Class and Description |
---|---|
static class |
Permissions.Permission
Represents a permission.
|
description, location, project
Constructor and Description |
---|
Permissions()
Create a set of Permissions.
|
Permissions(boolean delegateToOldSM)
Create a set of permissions.
|
Modifier and Type | Method and 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.
|
clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
public Permissions()
new Permissions(false)
.public Permissions(boolean delegateToOldSM)
delegateToOldSM
- if true
the old security manager
will be used if the permission has not been explicitly granted or revoked
in this instance.public void addConfiguredGrant(Permissions.Permission perm)
perm
- The Permissions.Permission to be granted.public void addConfiguredRevoke(Permissions.Permission perm)
perm
- The Permissions.Permission to be revokedpublic void setSecurityManager() throws BuildException
This method is no longer supported in Java 18 and higher versions and throws a
BuildException
. MagicNames.WARN_SECURITY_MANAGER_USAGE
property can be set to true
to log a warning message instead of throwing the exception.
BuildException
- on errorpublic void restoreSecurityManager() throws BuildException
This method is no longer supported in Java 18 and higher versions and throws a
BuildException
. MagicNames.WARN_SECURITY_MANAGER_USAGE
property can be set to true
to log a warning message instead of throwing the exception.
BuildException