User Plugin Execution Context

JFrog Integrations Documentation

Content Type

The Download, Storage, Execution ,and Build plugin types are executed under the identity of the user request that triggered them.

It is possible to force a block of plugin code to execute under the "system" role, which is not bound to any authorization rules and can therefore perform actions that are otherwise forbidden for the original user.

To run under the "system" role wrap your code with the asSystem closure:

... someCode ...
asSystem {
  //This code runs as the system role
... someOtherCode ...

Including AQL Queries

User plugins may include AQL queries opening up the full set of search capabilities that AQL has to offer. AQL queries are implemented within the Searches object as shown in the example below.Artifactory Query Language

import org.artifactory.repo.RepoPathFactory

executions {
   gemPropsPopulator() {
       def repoKey = "gem-local"
       ((Searches) searches).aql(
               "items.find({" +
                       "\"repo\": \"" + repoKey + "\"," +
                       "\"\$or\":[" +
                       "{\"property.key\":{\"\$ne\":\"\"}}," +
                       "{\"property.key\":{\"\$ne\":\"gem.version\"}}" +
                       "]})" +
                       ".include(\"path\", \"name\")") {
           AqlResult result ->
               result.each {