disable all the outreach capabilities

This commit is contained in:
Rui Lopes 2017-12-29 09:37:22 +00:00
parent 3299c92893
commit 4a642b65e6
1 changed files with 15 additions and 0 deletions

View File

@ -3,6 +3,7 @@
// see https://github.com/sonatype/nexus-book-examples/tree/nexus-3.x/scripting/nexus-script-example
import groovy.json.JsonOutput
import org.sonatype.nexus.capability.CapabilityRegistry
import org.sonatype.nexus.repository.storage.WritePolicy
import org.sonatype.nexus.security.user.UserSearchCriteria
import org.sonatype.nexus.security.authc.apikey.ApiKeyStore
@ -11,6 +12,20 @@ import org.apache.shiro.subject.SimplePrincipalCollection
import org.sonatype.nexus.scheduling.TaskScheduler
import org.sonatype.nexus.scheduling.schedule.Daily
// disable all the outreach capabilities.
capabilityRegistry = container.lookup(CapabilityRegistry.class)
capabilityRegistry.all.findAll {it.context().type().toString().startsWith("Outreach")}.each {
capabilityRegistry.disable(it.context().id())
}
// you can retrieve all capabilities with:
//return JsonOutput.toJson([
// capabilities: capabilityRegistry.all.collect {[
// id: it.context().id().toString(),
// type: it.context().type().toString(),
// enabled: it.context().enabled,
// ]}
//])
// create a raw repository backed by the default blob store.
// see https://github.com/sonatype/nexus-book-examples/blob/nexus-3.x/scripting/complex-script/rawRepositories.groovy
// see https://help.sonatype.com/display/NXRM3/Raw+Repositories+and+Maven+Sites#RawRepositoriesandMavenSites-UploadingFilestoHostedRawRepositories