diff --git a/classes/DataWarehouse/Query/Query.php b/classes/DataWarehouse/Query/Query.php
index 9a284cc39b..2b6b504508 100644
--- a/classes/DataWarehouse/Query/Query.php
+++ b/classes/DataWarehouse/Query/Query.php
@@ -462,6 +462,31 @@ public function getStatFields()
return $this->_stat_fields;
}
+ /**
+ * Add a where condition to the query and add the data to the pdo parameters. This
+ * function should be used when the right hand side of the where condition is untrused
+ * user supplied data.
+ *
+ * Note this function does not handle pdo parameterization of 'IN' conditions.
+ */
+ public function addPdoWhereCondition(\DataWarehouse\Query\Model\WhereCondition $where_condition)
+ {
+ // key on the non-parameterized form since the substitution string is different every time.
+ $key = $where_condition->__toString();
+
+ if (isset($this->_where_conditions[$key])) {
+ return;
+ }
+
+ $namedParam = $this->getNamedParameterMarker($where_condition->_right);
+
+ $this->_where_conditions[$key] = new \DataWarehouse\Query\Model\WhereCondition(
+ $where_condition->_left,
+ $where_condition->_operation,
+ $namedParam
+ );
+ }
+
public function addWhereCondition(\DataWarehouse\Query\Model\WhereCondition $where_condition)
{
$this->_where_conditions[$where_condition->__toString()] = $where_condition;
@@ -725,6 +750,22 @@ public function getCountQueryString()
$data_query .= ") as a WHERE a.total IS NOT NULL";
return $data_query;
}
+
+ /**
+ * Store a bound parameter for the query and return the named parameter
+ * marker that should be used in the SQL query.
+ *
+ * @param the value to bind to the query
+ * @return string a named parameter marker.
+ */
+ protected function getNamedParameterMarker($value)
+ {
+ $pdosubst = ':subst' . $this->pdoindex;
+ $this->pdoparams[$pdosubst] = $value;
+ $this->pdoindex += 1;
+ return $pdosubst;
+ }
+
public function setParameters(array $parameters = array())
{
$this->parameters = $parameters;
diff --git a/classes/DataWarehouse/Query/iJobMetadata.php b/classes/DataWarehouse/Query/iJobMetadata.php
new file mode 100644
index 0000000000..41e52e2672
--- /dev/null
+++ b/classes/DataWarehouse/Query/iJobMetadata.php
@@ -0,0 +1,143 @@
+ $jobId), $action);
$allRoles = $user->getAllRoles();
$query->setMultipleRoleParameters($allRoles, $user);
@@ -2086,15 +2082,17 @@ private function getJobByPrimaryKey(Application $app, \XDUser $user, $realm, $se
throw new \DataWarehouse\Query\Exceptions\AccessDeniedException;
}
- if (isset($searchparams['jobref'])) {
+ if (isset($searchparams['jobref']) && is_int($searchparams['jobref'])) {
$params = array(
- new \DataWarehouse\Query\Model\Parameter($rawstats['realms'][$realm]['primary_key'], '=', $searchparams['jobref'])
+ 'primary_key' => $searchparams['jobref']
);
- } else {
+ } elseif (isset($searchparams['resource_id']) && isset($searchparams['local_job_id'])) {
$params = array(
- new \DataWarehouse\Query\Model\Parameter("resource_id", "=", $searchparams['resource_id']),
- new \DataWarehouse\Query\Model\Parameter($rawstats['realms'][$realm]['ident_key'], "=", $searchparams['local_job_id'])
+ 'resource_id' => $searchparams['resource_id'],
+ 'job_identifier' => $searchparams['local_job_id']
);
+ } else {
+ throw new BadRequestException('invalid search parameters');
}
$QueryClass = "\\DataWarehouse\\Query\\$realm\\JobDataset";
diff --git a/configuration/portal_settings.ini b/configuration/portal_settings.ini
index 7ddfc9a153..74c39d4fad 100644
--- a/configuration/portal_settings.ini
+++ b/configuration/portal_settings.ini
@@ -38,7 +38,6 @@ email_token_expiration = "600"
[features]
xsede = "off"
appkernels = "off"
-singlejobviewer = "off"
; Enable support for multiple service providers.
;
diff --git a/html/gui/js/modules/job_viewer/SearchPanel.js b/html/gui/js/modules/job_viewer/SearchPanel.js
index 4c7922bc08..ce0267ea13 100644
--- a/html/gui/js/modules/job_viewer/SearchPanel.js
+++ b/html/gui/js/modules/job_viewer/SearchPanel.js
@@ -645,7 +645,7 @@ XDMoD.Module.JobViewer.SearchPanel = Ext.extend(Ext.Panel, {
fields: [
{name: 'dtype', mapping: 'dtype', type: 'string'},
{name: 'jobid', mapping: 'jobid', type: 'int'},
- {name: 'local_job_id', mapping: 'local_job_id', type: 'int'},
+ { name: 'local_job_id', mapping: 'local_job_id', type: 'string' },
{name: 'name', mapping: 'name', type: 'string'},
{name: 'realm', mapping: 'realm', type: 'string'},
{name: 'resource', mapping: 'resource', type: 'string'},
@@ -979,12 +979,11 @@ XDMoD.Module.JobViewer.SearchPanel = Ext.extend(Ext.Panel, {
}
},
{
- xtype: 'numberfield',
+ xtype: 'textfield',
fieldLabel: 'Job Number',
emptyText: 'Enter Job #',
id: 'basic-localjobid',
- allowNegative: false,
- autoStripChars: true,
+ stripCharsRe: /(^\s+|\s+$)/g,
width: 200,
enableKeyEvents: true,
listeners: {
diff --git a/html/index.php b/html/index.php
index a6b665fa1e..1ebde4abf4 100644
--- a/html/index.php
+++ b/html/index.php
@@ -475,7 +475,7 @@ function isReferrer($referrer)
-
+
diff --git a/templates/portal_settings.template b/templates/portal_settings.template
index db22224007..2590f05659 100644
--- a/templates/portal_settings.template
+++ b/templates/portal_settings.template
@@ -38,7 +38,6 @@ email_token_expiration = "[:general_email_token_expiration:]"
[features]
xsede = "off"
appkernels = "off"
-singlejobviewer = "off"
; Enable support for multiple service providers.
;