@Extension public class ScriptApproval extends Object implements hudson.model.RootAction, hudson.model.Saveable
Modifier and Type | Class and Description |
---|---|
static class |
ScriptApproval.ApprovedClasspathEntry
Approved classpath entry.
|
static class |
ScriptApproval.ApprovedWhitelist |
static class |
ScriptApproval.PendingClasspathEntry
A classpath entry requiring approval by an administrator.
|
static class |
ScriptApproval.PendingScript |
static class |
ScriptApproval.PendingSignature |
static class |
ScriptApproval.PendingThing |
Constructor and Description |
---|
ScriptApproval() |
@Nonnull public static ScriptApproval get()
public String configuring(@Nonnull String script, @Nonnull Language language, @Nonnull ApprovalContext context)
DataBoundConstructor
.
It should also be called from a readResolve
method (which may then simply return this
),
so that administrators can for example POST to config.xml
and have their scripts be considered approved.
If the script has already been approved, this does nothing.
Otherwise, if this user has the Jenkins.RUN_SCRIPTS
permission (and is not ACL.SYSTEM
), or Jenkins is running without security, it is added to the approved list.
Otherwise, it is added to the pending list.
script
- the text of a possibly novel scriptlanguage
- the language in which it is writtencontext
- any additional information about how where or by whom this is being configuredscript
, for conveniencepublic String using(@Nonnull String script, @Nonnull Language language) throws UnapprovedUsageException
script
- a possibly unapproved scriptlanguage
- the language in which it is writtenscript
, for convenienceUnapprovedUsageException
- in case it has not yet been approvedpublic void configuring(@Nonnull ClasspathEntry entry, @Nonnull ApprovalContext context)
configuring(String, Language, ApprovalContext)
.url
- the location of the entrycontext
- any additional informationpublic hudson.util.FormValidation checking(@Nonnull ClasspathEntry entry)
checking(String, Language)
but for classpath entries.
(This is automatic if use ClasspathEntry
as a configuration element.)entry
- the classpath entry to verifypublic void using(@Nonnull ClasspathEntry entry) throws IOException, UnapprovedClasspathException
entry
- a classpath entryIOException
- when failed to the entry is inaccessibleUnapprovedClasspathException
- when the entry is not approvedpublic hudson.util.FormValidation checking(@Nonnull String script, @Nonnull Language language)
doCheckFieldName
method.script
- a possibly unapproved scriptlanguage
- the language in which it is writtenJenkins.RUN_SCRIPTS
, else FormValidation.ok()
public String preapprove(@Nonnull String script, @Nonnull Language language)
script
- the text of a possibly novel scriptlanguage
- the language in which it is writtenscript
, for conveniencepublic void preapproveAll()
@LocalData
.public RejectedAccessException accessRejected(@Nonnull RejectedAccessException x, @Nonnull ApprovalContext context)
x
- an exception with the detailscontext
- any additional information about where or by whom this script was runx
, for convenience in rethrowing@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public String[] getApprovedSignatures()
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public String[] getAclApprovedSignatures()
public String getIconFileName()
getIconFileName
in interface hudson.model.Action
public String getDisplayName()
getDisplayName
in interface hudson.model.Action
getDisplayName
in interface hudson.model.ModelObject
public String getUrlName()
getUrlName
in interface hudson.model.Action
public void save() throws IOException
save
in interface hudson.model.Saveable
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public Set<ScriptApproval.PendingScript> getPendingScripts()
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public void approveScript(String hash) throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public void denyScript(String hash) throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public void clearApprovedScripts() throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public Set<ScriptApproval.PendingSignature> getPendingSignatures()
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public String[][] approveSignature(String signature) throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public String[][] aclApproveSignature(String signature) throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public void denySignature(String signature) throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public String[][] clearApprovedSignatures() throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public List<ScriptApproval.ApprovedClasspathEntry> getApprovedClasspathEntries()
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) public List<ScriptApproval.PendingClasspathEntry> getPendingClasspathEntries()
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public net.sf.json.JSON getClasspathRenderInfo()
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public net.sf.json.JSON approveClasspathEntry(String hash) throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public net.sf.json.JSON denyClasspathEntry(String hash) throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public net.sf.json.JSON denyApprovedClasspathEntry(String hash) throws IOException
IOException
@Restricted(value=org.kohsuke.accmod.restrictions.NoExternalUse.class) @JavaScriptMethod public net.sf.json.JSON clearApprovedClasspathEntries() throws IOException
IOException
Copyright © 2015. All rights reserved.