Class ScriptApproval

    • Constructor Detail

      • ScriptApproval

        @DataBoundConstructor
        public ScriptApproval()
    • Method Detail

      • configuring

        public String configuring​(@Nonnull
                                  String script,
                                  @Nonnull
                                  Language language,
                                  @Nonnull
                                  ApprovalContext context)
        Used when someone is configuring a script. Typically you would call this from a 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.ADMINISTER 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.

        Parameters:
        script - the text of a possibly novel script
        language - the language in which it is written
        context - any additional information about how where or by whom this is being configured
        Returns:
        script, for convenience
        Throws:
        IllegalStateException - Jenkins instance is not ready
      • preapprove

        public String preapprove​(@Nonnull
                                 String script,
                                 @Nonnull
                                 Language language)
        Unconditionally approve a script. Does no access checks and does not automatically save changes to disk. Useful mainly for testing.
        Parameters:
        script - the text of a possibly novel script
        language - the language in which it is written
        Returns:
        script, for convenience
      • preapproveAll

        public void preapproveAll()
        Unconditionally approves all pending scripts. Does no access checks and does not automatically save changes to disk. Useful mainly for testing in combination with @LocalData.
      • maybeRegister

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public static void maybeRegister​(@Nonnull
                                         RejectedAccessException x)
      • pushRegistrationCallback

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public static void pushRegistrationCallback​(Consumer<RejectedAccessException> callback)
      • popRegistrationCallback

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public static void popRegistrationCallback()
      • setApprovedSignatures

        @DataBoundSetter
        public void setApprovedSignatures​(String[] signatures)
                                   throws IOException
        Throws:
        IOException
      • getApprovedSignatures

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public String[] getApprovedSignatures()
      • getDangerousApprovedSignatures

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public String[] getDangerousApprovedSignatures()
      • getAclApprovedSignatures

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public String[] getAclApprovedSignatures()
      • approveScript

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public void approveScript​(String hash)
                           throws IOException
        Throws:
        IOException
      • denyScript

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public void denyScript​(String hash)
                        throws IOException
        Throws:
        IOException
      • clearApprovedScripts

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public void clearApprovedScripts()
                                  throws IOException
        Throws:
        IOException
      • approveSignature

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public String[][] approveSignature​(String signature)
                                    throws IOException
        Throws:
        IOException
      • aclApproveSignature

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public String[][] aclApproveSignature​(String signature)
                                       throws IOException
        Throws:
        IOException
      • denySignature

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public void denySignature​(String signature)
                           throws IOException
        Throws:
        IOException
      • clearApprovedSignatures

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public String[][] clearApprovedSignatures()
                                           throws IOException
        Throws:
        IOException
      • clearDangerousApprovedSignatures

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public String[][] clearDangerousApprovedSignatures()
                                                    throws IOException
        Throws:
        IOException
      • getClasspathRenderInfo

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public net.sf.json.JSON getClasspathRenderInfo()
      • approveClasspathEntry

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public net.sf.json.JSON approveClasspathEntry​(String hash)
                                               throws IOException
        Throws:
        IOException
      • denyClasspathEntry

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public net.sf.json.JSON denyClasspathEntry​(String hash)
                                            throws IOException
        Throws:
        IOException
      • denyApprovedClasspathEntry

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public net.sf.json.JSON denyApprovedClasspathEntry​(String hash)
                                                    throws IOException
        Throws:
        IOException
      • clearApprovedClasspathEntries

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        @JavaScriptMethod
        public net.sf.json.JSON clearApprovedClasspathEntries()
                                                       throws IOException
        Throws:
        IOException