From 68ac270441c79f6416ba40dd46c343c554c3302e Mon Sep 17 00:00:00 2001 From: Edgar Serrato Date: Thu, 14 Apr 2022 16:02:19 -0500 Subject: [PATCH 1/2] Added session validation. Updated build for replacing deprecated bintray dependencies. --- build.gradle | 64 ++++++++++++++++++++---- cgi-bin/openstack.cgi | 18 +++++++ cgi-bin/openstackMonitor.cgi | 18 +++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- help/help.adoc | 6 ++- 5 files changed, 95 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 399d3e3..c5892bf 100644 --- a/build.gradle +++ b/build.gradle @@ -8,27 +8,69 @@ buildscript { repositories { - maven { - url 'http://dl.bintray.com/ecpluginsdev/maven' - } - - jcenter() + mavenCentral() + mavenLocal() + maven { + url 'https://nexus-internal.cloudbees.com/content/groups/mirror' + credentials { + username = System.getenv('NEXUS_USERNAME') ?: nexusUsername + password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword + } + } } dependencies { - classpath group: 'com.electriccloud.plugins', name: 'flow-gradle-plugin', version: '+' - classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0' + classpath group: 'com.electriccloud.plugins', name: 'flow-gradle-plugin', version: '2.4' } } repositories { + mavenCentral() + mavenLocal() maven { - url "https://oss.sonatype.org/content/repositories/snapshots" + url 'https://nexus-internal.cloudbees.com/content/repositories/snapshots' + credentials { + username = System.getenv('NEXUS_USERNAME') ?: nexusUsername + password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword + } + } + maven { + url 'https://nexus-internal.cloudbees.com/service/local/staging/deploy/maven2' + credentials { + username = System.getenv('NEXUS_USERNAME') ?: nexusUsername + password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword + } + } + maven { + url 'https://nexus-internal.cloudbees.com/content/groups/mirror' + credentials { + username = System.getenv('NEXUS_USERNAME') ?: nexusUsername + password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword + } + } +} + +configurations.all { + resolutionStrategy { + force group: 'com.electriccloud', name: 'ec-test', version: '10.1.0' + force group: 'com.electriccloud', name: 'commander-client', version: '10.1.0' + force group: 'com.electriccloud', name: 'commander-sdk', version: '6.1.2.1' + force group: 'com.electriccloud', name: 'ec_internal', version: '6.1.2.1' + force group: 'com.google.gwt', name: 'gwt-user', version: '2.5.0-ec3' + force group: 'com.google.gwt', name: 'gwt-dev', version: '2.5.0-ec1' + + // force group: 'com.electriccloud', name: 'commander-client', version: '10.1.0' + // force group: 'com.electriccloud', name: 'commander-sdk', version: '6.1.2.1' + // force group: 'com.electriccloud', name: 'ec_internal', version: '6.1.2.1' + // force group: 'com.google.gwt', name: 'gwt-user', version: '2.5.0-ec3' + // force group: 'com.google.gwt', name: 'gwt-dev', version: '2.5.0-ec1' + + cacheChangingModulesFor 0, 'seconds' } } group = "com.electriccloud" description = "Plugins : EC-OpenStack" -version = "1.3.6" +version = "1.3.7" apply plugin: 'groovy' apply plugin: 'flow-gradle-plugin' @@ -37,7 +79,7 @@ apply plugin: 'license' license { header = file ('shortHeader.txt') exclude "**/project.xml" -} +} configurations { // Configuration for the jar files we want @@ -85,7 +127,7 @@ test { } task wrapper(type: Wrapper) { - gradleVersion = '2.3' + gradleVersion = '2.13' } // Include any dependent jars in the plugin jar file for diff --git a/cgi-bin/openstack.cgi b/cgi-bin/openstack.cgi index cb6ff97..13cbc59 100644 --- a/cgi-bin/openstack.cgi +++ b/cgi-bin/openstack.cgi @@ -216,6 +216,24 @@ sub xmlQuote($) { return $string; } +################################ +# validateUserSession +# +# Check current session on valid, if not - redirects +# user to the login page. +################################ +sub validateUserSession() { + + my $ec = new ElectricCommander({abortOnError => 0}); + $ec->login(); + if($ec->getError()) { + print "Location: ../../../\n\n"; + exit 0; + } +} + +validateUserSession(); + main(); diff --git a/cgi-bin/openstackMonitor.cgi b/cgi-bin/openstackMonitor.cgi index 9222d42..8753536 100644 --- a/cgi-bin/openstackMonitor.cgi +++ b/cgi-bin/openstackMonitor.cgi @@ -198,5 +198,23 @@ sub reportSuccess($) { print "Success"; } +################################ +# validateUserSession +# +# Check current session on valid, if not - redirects +# user to the login page. +################################ +sub validateUserSession() { + + my $ec = new ElectricCommander({abortOnError => 0}); + $ec->login(); + if($ec->getError()) { + print "Location: ../../../\n\n"; + exit 0; + } +} + +validateUserSession(); + main(); exit SUCCESS; diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 848704d..599a6b5 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip diff --git a/help/help.adoc b/help/help.adoc index 4b24a00..1a4e621 100644 --- a/help/help.adoc +++ b/help/help.adoc @@ -789,9 +789,13 @@ image::cloudbees-common::cd-plugins/ec-openstack/use-cases/case-1/cleanup-log.pn [[rns]] == Release notes +=== EC-OpenStack 1.3.7 + +* Added session validation. + === EC-OpenStack 1.3.6 -* The documentation hahs been migrated to the main documentation site. +* The documentation has been migrated to the main documentation site. === EC-OpenStack 1.3.5 From f139531af604e96f7b16f454f63355984f85ad1b Mon Sep 17 00:00:00 2001 From: Edgar Serrato Date: Thu, 14 Apr 2022 16:46:39 -0500 Subject: [PATCH 2/2] Updated date in help.adoc --- help/help.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/help/help.adoc b/help/help.adoc index 1a4e621..ffde04e 100644 --- a/help/help.adoc +++ b/help/help.adoc @@ -1,6 +1,6 @@ Plugin Version @PLUGIN_VERSION@ -Revised on December 25, 2018 +Revised on April 14, 2022 == Integrated version