Skip to content

Commit

Permalink
Merge branch 'xdmod8.1' into coldfront_integration_lite
Browse files Browse the repository at this point in the history
  • Loading branch information
plessbd authored Nov 9, 2018
2 parents 882ef29 + 4552ced commit 196b1ad
Show file tree
Hide file tree
Showing 546 changed files with 6,510 additions and 2,147 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM tas-tools-ext-01.ccr.xdmod.org/xdmod-centos7:open7.5.1-v5
FROM tas-tools-ext-01.ccr.xdmod.org/xdmod-centos7:open8.0.0-v1
3 changes: 1 addition & 2 deletions bin/xdmod-upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ ini_set('memory_limit', -1);
* @var array
*/
$supportedUpgrades = array(
'7.5.0' => '7.5.1',
'7.5.1' => '8.0.0',
'8.0.0' => '8.1.0',
);

/**
Expand Down
72 changes: 16 additions & 56 deletions classes/Authentication/SAML/XDSamlAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ class XDSamlAuthentication
Name: %s
Username: %s
E-Mail: %s
Organization ID: %s
Organization Name: %s
SAML Attributes ----------------------------------
%s
Expand Down Expand Up @@ -244,71 +242,33 @@ public function getLoginLink()
* @param array $samlAttributes the attributes that we received via SAML for this user.
* @param boolean $linked whether or not we were able to link the SSO User with an XDMoD Person.
* @throws Exception if there is a problem with notifying the user.
* @throws Exception if there is a problem retrieving the name for the users organization.
*/
private function handleNotifications(XDUser $user, $samlAttributes, $linked)
{
// We only notify admins iff we were unable to identify which organization the user should
// be associated with ( i.e. we had to assign them to the 'Unknown' organization ).
if ($user->getOrganizationID() === -1) {
$techSupportRecipient = \xd_utilities\getConfiguration('general', 'tech_support_recipient');
$senderEmail = \xd_utilities\getConfiguration('mailer', 'sender_email');

$userEmail = $user->getEmailAddress()
? $user->getEmailAddress()
: $samlAttributes['email_address'][0];

$userOrganization = $user->getOrganizationID();

$emailBody = sprintf(
self::BASE_ADMIN_EMAIL,
$user->getFormalName(true),
$user->getUsername(),
$userEmail,
$userOrganization,
Organizations::getNameById($userOrganization),
json_encode($samlAttributes, JSON_PRETTY_PRINT)
);
if ($user->getOrganizationID() !== -1) {
// Only send email if we were unable to identify an organization for the user.
return;
}

$subject = sprintf(
'New %s Single Sign On User Created',
($linked ? 'Linked' : 'Unlinked')
);
$subject = sprintf(
'New %s Single Sign On User Created',
($linked ? 'Linked' : 'Unlinked')
);

$this->notify(
$techSupportRecipient,
$techSupportRecipient,
'',
$senderEmail,
$subject,
$emailBody
);
}
}
$body = sprintf(
self::BASE_ADMIN_EMAIL,
$user->getFormalName(true),
$user->getUsername(),
$user->getEmailAddress(),
json_encode($samlAttributes, JSON_PRETTY_PRINT)
);

/**
* Attempt to generate / send a notification email with the specified parameters.
*
* @param string $toAddress the address that the notification will be sent to.
* @param string $fromAddress the address that the notification will be sent from.
* @param string $fromName A name to be used when identifying the `$fromAddress`
* @param string $replyAddress the address to be used when a user replies to the notification.
* @param string $subject the subject of the notification.
* @param string $body the body of the notification.
*
* @throws Exception if there is a problem sending the notification email.
*/
public function notify($toAddress, $fromAddress, $fromName, $replyAddress, $subject, $body)
{
try {
MailWrapper::sendMail(
array(
'subject' => $subject,
'body' => $body,
'toAddress' => $toAddress,
'fromAddress' => $fromAddress,
'fromName' => $fromName,
'replyAddress' => $replyAddress
'toAddress' => \xd_utilities\getConfiguration('general', 'tech_support_recipient')
)
);
} catch (Exception $e) {
Expand Down
44 changes: 34 additions & 10 deletions classes/Rest/Controllers/WarehouseControllerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -1482,8 +1482,15 @@ private function getJobData(Application $app, XDUser $user, $realm, $jobId, $act
*/
private function getJobDataSet(XDUser $user, $realm, $jobId, $action)
{
$config = \Xdmod\Config::factory();

$rawstats = $config['rawstatistics'];
if (!isset($rawstats['realms'][$realm])) {
throw new \DataWarehouse\Query\Exceptions\AccessDeniedException;
}

$params = array(
new \DataWarehouse\Query\Model\Parameter('_id', '=', $jobId)
new \DataWarehouse\Query\Model\Parameter($rawstats['realms'][$realm]['primary_key'], '=', $jobId)
);

$QueryClass = "\\DataWarehouse\\Query\\$realm\\JobDataset";
Expand Down Expand Up @@ -1761,17 +1768,27 @@ private function processHistoryRequest(Application $app, XDUser $user, $realm, $
*/
private function processHistoryDefaultRealmRequest(Application $app, $action)
{
$config = \Xdmod\Config::factory();

$rawstats = $config['rawstatistics'];

$results = array();

if (isset($rawstats['realms'])) {
foreach($rawstats['realms'] as $realm => $realmconfig) {
$results[] = array(
'dtype' => 'realm',
'realm' => $realm,
'text' => $realmconfig['name']
);
}
}

return $app->json(
array(
'success' => true,
'action' => $action,
'results' => array(
array(
'dtype' => 'realm',
'realm' => 'SUPREMM',
'text' => 'SUPREMM'
)
)
'results' => $results
)
);
}
Expand Down Expand Up @@ -2062,14 +2079,21 @@ private function getJobTimeSeriesData(Application $app, Request $request, \XDUse
*/
private function getJobByPrimaryKey(Application $app, \XDUser $user, $realm, $searchparams)
{
$config = \Xdmod\Config::factory();

$rawstats = $config['rawstatistics'];
if (!isset($rawstats['realms'][$realm])) {
throw new \DataWarehouse\Query\Exceptions\AccessDeniedException;
}

if (isset($searchparams['jobref'])) {
$params = array(
new \DataWarehouse\Query\Model\Parameter('_id', '=', $searchparams['jobref'])
new \DataWarehouse\Query\Model\Parameter($rawstats['realms'][$realm]['primary_key'], '=', $searchparams['jobref'])
);
} else {
$params = array(
new \DataWarehouse\Query\Model\Parameter("resource_id", "=", $searchparams['resource_id']),
new \DataWarehouse\Query\Model\Parameter("local_job_id", "=", $searchparams['local_job_id'])
new \DataWarehouse\Query\Model\Parameter($rawstats['realms'][$realm]['ident_key'], "=", $searchparams['local_job_id'])
);
}

Expand Down
2 changes: 1 addition & 1 deletion configuration/portal_settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ contact_page_recipient = ""
tech_support_recipient = ""

; The version number is updated during the upgrade process.
version = "8.0.0"
version = "8.1.0"

debug_mode = "off"
debug_recipient = ""
Expand Down
Empty file.
3 changes: 3 additions & 0 deletions configuration/rawstatistics.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"realms": []
}
14 changes: 7 additions & 7 deletions etl/js/lib/dataset_processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,16 +240,17 @@ DatasetProcessor.prototype.process = function (totalCores, coreIndex) {
var self = this;
var multiCore = totalCores !== undefined && coreIndex !== undefined;
if (this.dataset.input.dbEngine == 'mongodb') {
var uri_decode_auth = this.dataset.input.config.uri.indexOf('@') > -1;

MongoClient.connect(self.dataset.input.config.uri, {native_parser: true, uri_decode_auth: uri_decode_auth}, function(err, db) {
MongoClient.connect(self.dataset.input.config.uri, { useNewUrlParser: true }, function (err, client) {
if (err) {
self.emit("error", self.dataset.name + ': ' + "MongoClient Open Error: " + util.inspect(err));
self._processEnded = true;
self.onEndProcess();
return;
}

self.client = client;
var db = client.db();

self.emit('message', self.dataset.name + ': connected to database \'' + db.databaseName + '\'');

//look for jobs that haven't been processed yet,
Expand All @@ -267,8 +268,7 @@ DatasetProcessor.prototype.process = function (totalCores, coreIndex) {
return;
}

self.db = db;
self.collection = self.db.collection(self.dataset.input.config.collection);
self.collection = db.collection(self.dataset.input.config.collection);

// Ensure the query is indexed
var indexParams = {};
Expand Down Expand Up @@ -378,8 +378,8 @@ DatasetProcessor.prototype.onEndProcess = function () {
if (this.stats.currentlyMarking === 0) {
this.mysqlPool.end();
this.emit('message', this.dataset.name + ': mysqlPool closed');
if (this.db) {
this.db.close();
if (this.client) {
this.client.close(true);
this.emit('message', this.dataset.name + ': mongo connection closed');
}

Expand Down
2 changes: 1 addition & 1 deletion etl/js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dependencies": {
"cloneextend": "0.0.x",
"ini": "1.2.x",
"mongodb": "2.1.x",
"mongodb": "3.1.x",
"mysql": "2.2.x",
"tv4": "^1.0.13",
"winston": "0.7.x",
Expand Down
4 changes: 3 additions & 1 deletion html/gui/js/modules/job_viewer/JobViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ XDMoD.Module.JobViewer = Ext.extend(XDMoD.PortalModule, {
modal: true,
title: 'Search',
layout: 'fit',
resizable: false,
resizable: true,
boxMaxHeight: 641,
boxMaxWidth: 1014,
items: [searchPanel]
});
searchPanel.relayEvents(self.searchWindow, ['show', 'hide', 'move']);
Expand Down
Loading

0 comments on commit 196b1ad

Please sign in to comment.