Skip to content

Commit

Permalink
Merge pull request #61 from electric-cloud/BEE-17381
Browse files Browse the repository at this point in the history
Validate sesion
  • Loading branch information
imago-storm committed Apr 10, 2022
2 parents d0f2346 + c70ce15 commit e35f118
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 18 deletions.
75 changes: 57 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,44 @@

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

jcenter()
mavenLocal()
mavenCentral()
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/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 group: 'com.electriccloud.plugins', name: 'flow-gradle-plugin', version: '2.4'
}
}


repositories {
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
mavenCentral()
// maven { url 'https://repo.cloudbees.com/content/repositories/dev-connect' }
maven {
url 'https://nexus-internal.cloudbees.com/content/groups/mirror'
credentials {
username = System.getenv('NEXUS_USERNAME') ?: nexusUsername
password = System.getenv('NEXUS_PASSWORD') ?: nexusPassword
}
}
}

group = "com.electriccloud"
description = "Plugins : EC-Chef"
version = "1.2.5"
version = "1.2.6"

apply plugin: 'flow-gradle-plugin'

Expand All @@ -40,16 +58,37 @@ task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}

dependencies {
testCompile "junit:junit:4.12"
testCompile "org.hamcrest:hamcrest-library:1.3"
testCompile "com.googlecode.json-simple:json-simple:1.1"
testCompile "commons-logging:commons-logging:1.2"
testCompile "org.apache.httpcomponents:httpcore:4.4.4"
testCompile "org.apache.httpcomponents:httpclient:4.3.6"
testCompile "commons-codec:commons-codec:1.10"
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'
}
}

// dependencies {
// testCompile "junit:junit:4.12"
// testCompile "org.hamcrest:hamcrest-library:1.3"
// testCompile "com.googlecode.json-simple:json-simple:1.1"
// testCompile "commons-logging:commons-logging:1.2"
// testCompile "org.apache.httpcomponents:httpcore:4.4.4"
// testCompile "org.apache.httpcomponents:httpclient:4.3.6"
// testCompile "commons-codec:commons-codec:1.10"
// }



test
{
systemProperties['PLUGIN_VERSION'] = version
Expand Down
12 changes: 12 additions & 0 deletions cgi-bin/chef.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,18 @@ sub xmlQuote($) {
return $string;
}

sub validateUserSession() {

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

validateUserSession();

main();


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

sub validateUserSession() {

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

validateUserSession();

main();
exit SUCCESS;

0 comments on commit e35f118

Please sign in to comment.