diff --git a/actions/terms.js b/actions/terms.js index 0baeb0efb..8d3e057c7 100755 --- a/actions/terms.js +++ b/actions/terms.js @@ -49,16 +49,17 @@ 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) { @@ -66,7 +67,7 @@ var getTermsOfUse = function (api, connection, dbConnectionMap, next) { 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.')); @@ -211,7 +212,7 @@ exports.getTermsOfUse = { description: "getTermsOfUse", inputs: { required: ["termsOfUseId"], - optional: [] + optional: ["noauth"] }, blockedConnectionTypes: [], outputExample: {}, diff --git a/queries/get_terms_of_use_noauth b/queries/get_terms_of_use_noauth new file mode 100644 index 000000000..ee815774e --- /dev/null +++ b/queries/get_terms_of_use_noauth @@ -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@ diff --git a/queries/get_terms_of_use_noauth.json b/queries/get_terms_of_use_noauth.json new file mode 100644 index 000000000..b00f1ea31 --- /dev/null +++ b/queries/get_terms_of_use_noauth.json @@ -0,0 +1,5 @@ +{ + "name" : "get_terms_of_use_noauth", + "db" : "common_oltp", + "sqlfile" : "get_terms_of_use_noauth" +} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy