From aba1c4097c36f40ae9765fda53debf84935b172e Mon Sep 17 00:00:00 2001 From: Tom Ladendorf Date: Wed, 21 Sep 2016 14:55:20 +0200 Subject: [PATCH 1/2] Added noauth terms endpoint --- actions/terms.js | 11 ++++++----- queries/get_terms_of_use_noauth | 6 ++++++ queries/get_terms_of_use_noauth.json | 5 +++++ 3 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 queries/get_terms_of_use_noauth create mode 100644 queries/get_terms_of_use_noauth.json 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..68a5909fe --- /dev/null +++ b/queries/get_terms_of_use_noauth @@ -0,0 +1,6 @@ +SELECT tou.terms_of_use_id as terms_of_use_id, + tou.title as title, + tou.url as url, + tou.terms_text as text +FROM terms_of_use tou +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" +} From d22acdf9e554a17326b04f0ab8a259bd5fc09d0b Mon Sep 17 00:00:00 2001 From: Tom Ladendorf Date: Fri, 23 Sep 2016 15:55:01 +0200 Subject: [PATCH 2/2] updated terms noauth query --- queries/get_terms_of_use_noauth | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/queries/get_terms_of_use_noauth b/queries/get_terms_of_use_noauth index 68a5909fe..ee815774e 100644 --- a/queries/get_terms_of_use_noauth +++ b/queries/get_terms_of_use_noauth @@ -1,6 +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 + 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@ 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