Skip to content

Commit

Permalink
Merge pull request #106 from electric-cloud/BEE-17394
Browse files Browse the repository at this point in the history
Added session validation. Updated gradle project in order to replace deprecated Bintray references.
  • Loading branch information
eserratocb authored Apr 13, 2022
2 parents e6f4829 + d644418 commit 21fdca5
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 12 deletions.
72 changes: 61 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,70 @@


buildscript {
repositories {
maven {
url 'http://dl.bintray.com/ecpluginsdev/maven'
}

jcenter()
}
repositories {
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://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-S3"
version = "1.1.2"
version = "1.1.3"

apply plugin: 'flow-gradle-plugin'
apply plugin: 'license'
Expand Down Expand Up @@ -64,4 +112,6 @@ test {
}
}

task wrapper(type: Wrapper) { gradleVersion = '2.13' }
task wrapper(type: Wrapper) {
gradleVersion = '2.13'
}
17 changes: 17 additions & 0 deletions cgi-bin/s3.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,23 @@ sub xmlQuote($) {
return $string;
}

###############################################
# validateUserSession
#
# Check current session on valid, if not - redirects
# user to the login page.
###############################################
sub validateUserSession() {

my $ec = ElectricCommander->new({abortOnError => 0});
$ec->login();
if($ec->getError()) {
print "Location: ../../../\n\n";
exit 0;
}
}

validateUserSession();

main();

Expand Down
18 changes: 18 additions & 0 deletions cgi-bin/s3Monitor.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -179,5 +179,23 @@ sub reportSuccess($) {
print "Success";
}

###############################################
# validateUserSession
#
# Check current session on valid, if not - redirects
# user to the login page.
###############################################
sub validateUserSession() {

my $ec = ElectricCommander->new({abortOnError => 0});
$ec->login();
if($ec->getError()) {
print "Location: ../../../\n\n";
exit 0;
}
}

validateUserSession();

main();
exit 0;
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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.13-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-all.zip
4 changes: 4 additions & 0 deletions help/help.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,10 @@ image::cloudbees-common::cd-plugins/ec-s3/use-cases/case-1/website-hosting-log.p
[[rns]]
== Release notes

=== EC-S3 1.1.3

* Added session validation.

=== EC-S3 1.1.2

* The documentation has been migrated to the main documentation site.
Expand Down

0 comments on commit 21fdca5

Please sign in to comment.