Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Promote Dev to Master #489

Merged
merged 3 commits into from
Sep 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions actions/terms.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,25 @@ function validateTermsOfUseId(connection, helper, sqlParams, callback) {
var getTermsOfUse = function (api, connection, dbConnectionMap, next) {
var helper = api.helper,
sqlParams = {},
result = {};
result = {},
noauth = connection.params.noauth == "true";

//Check if the user is logged-in
if (connection.caller.accessLevel === "anon") {
if (!noauth && connection.caller.accessLevel === "anon") {
helper.handleError(api, connection, new UnauthorizedError("Authentication credential was missing."));
next(connection, true);
return;
}

sqlParams.userId = connection.caller.userId;
sqlParams.userId = connection.caller ? connection.caller.userId || '' : '';

async.waterfall([
function (cb) {
// validate termsOfUseId parameter and set sql parameter
validateTermsOfUseId(connection, helper, sqlParams, cb);
},
function (cb) {
api.dataAccess.executeQuery("get_terms_of_use", sqlParams, dbConnectionMap, cb);
api.dataAccess.executeQuery(noauth ? "get_terms_of_use_noauth" : "get_terms_of_use", sqlParams, dbConnectionMap, cb);
}, function (rows, cb) {
if (rows.length === 0) {
cb(new NotFoundError('No such terms of use exists.'));
Expand Down Expand Up @@ -211,7 +212,7 @@ exports.getTermsOfUse = {
description: "getTermsOfUse",
inputs: {
required: ["termsOfUseId"],
optional: []
optional: ["noauth"]
},
blockedConnectionTypes: [],
outputExample: {},
Expand Down
10 changes: 10 additions & 0 deletions queries/get_terms_of_use_noauth
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
SELECT tou.terms_of_use_id as terms_of_use_id,
tou.title as title,
tou.url as url,
tou.terms_text as text,
touat.terms_of_use_agreeability_type_id as agreeability_type_id,
toudtx.docusign_template_id as docusign_template_id
FROM terms_of_use tou
INNER JOIN terms_of_use_agreeability_type_lu touat ON touat.terms_of_use_agreeability_type_id = tou.terms_of_use_agreeability_type_id
LEFT JOIN terms_of_use_docusign_template_xref toudtx ON toudtx.terms_of_use_id = tou.terms_of_use_id
WHERE tou.terms_of_use_id = @termsOfUseId@
5 changes: 5 additions & 0 deletions queries/get_terms_of_use_noauth.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name" : "get_terms_of_use_noauth",
"db" : "common_oltp",
"sqlfile" : "get_terms_of_use_noauth"
}