public final class SecureGroovyScript extends AbstractDescribableImpl<SecureGroovyScript> implements Serializable
DataBoundConstructor
parameter;
you must call configuring(org.jenkinsci.plugins.scriptsecurity.scripts.ApprovalContext)
or a related method from your own constructor.
Use <f:property field="…"/>
to configure it from Jelly.Modifier and Type | Class and Description |
---|---|
static class |
SecureGroovyScript.DescriptorImpl |
Constructor and Description |
---|
SecureGroovyScript(String script,
boolean sandbox)
Deprecated.
|
SecureGroovyScript(String script,
boolean sandbox,
List<ClasspathEntry> classpath) |
Modifier and Type | Method and Description |
---|---|
SecureGroovyScript |
configuring(ApprovalContext context)
To be called in your own
DataBoundConstructor when storing the field of this type. |
SecureGroovyScript |
configuringWithKeyItem()
|
SecureGroovyScript |
configuringWithNonKeyItem()
Convenience form of
configuring(org.jenkinsci.plugins.scriptsecurity.scripts.ApprovalContext) that calls ApprovalContext.withCurrentUser() and ApprovalContext.withItem(hudson.model.Item) . |
Object |
evaluate(ClassLoader loader,
groovy.lang.Binding binding)
Deprecated.
|
Object |
evaluate(ClassLoader loader,
groovy.lang.Binding binding,
TaskListener listener)
Runs the Groovy script, using the sandbox if so configured.
|
List<ClasspathEntry> |
getClasspath() |
String |
getOldScript() |
String |
getScript() |
boolean |
isSandbox() |
boolean |
isScriptAutoApprovalEnabled() |
void |
setOldScript(String oldScript) |
getDescriptor
@DataBoundConstructor public SecureGroovyScript(@NonNull String script, boolean sandbox, @CheckForNull List<ClasspathEntry> classpath)
@Deprecated public SecureGroovyScript(@NonNull String script, boolean sandbox)
@NonNull public String getScript()
public boolean isSandbox()
@NonNull public List<ClasspathEntry> getClasspath()
public String getOldScript()
@DataBoundSetter public void setOldScript(String oldScript)
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public boolean isScriptAutoApprovalEnabled()
public SecureGroovyScript configuring(ApprovalContext context)
DataBoundConstructor
when storing the field of this type.context
- an approval contextpublic SecureGroovyScript configuringWithKeyItem()
public SecureGroovyScript configuringWithNonKeyItem()
configuring(org.jenkinsci.plugins.scriptsecurity.scripts.ApprovalContext)
that calls ApprovalContext.withCurrentUser()
and ApprovalContext.withItem(hudson.model.Item)
.@Deprecated public Object evaluate(ClassLoader loader, groovy.lang.Binding binding) throws Exception
evaluate(ClassLoader, Binding, TaskListener)
Exception
public Object evaluate(ClassLoader loader, groovy.lang.Binding binding, @CheckForNull TaskListener listener) throws Exception
loader
- a class loader for constructing the shell, such as PluginManager.uberClassLoader
(will be augmented by getClasspath()
if nonempty)binding
- Groovy variable bindingslistener
- a way to print messagesGroovyShell.evaluate(String)
Exception
- in case of a general problemRejectedAccessException
- in case of a sandbox issueUnapprovedUsageException
- in case of a non-sandbox issueUnapprovedClasspathException
- in case some unapproved classpath entries were requestedCopyright © 2016–2023. All rights reserved.