From 517391d0d3a9ddf0bc340973edc9cf976fbb0938 Mon Sep 17 00:00:00 2001 From: sairajzero Date: Sun, 27 Nov 2022 18:36:11 +0530 Subject: [PATCH] Removed constraint - Constraint: personDetails required for adding logs in private sheets --- index.html | 2 +- scripts/logsheet.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 500c97f..608494f 100644 --- a/index.html +++ b/index.html @@ -1276,10 +1276,10 @@ getRef('sheet_type').textContent = editors ? 'Private' : 'Public'; renderElem(getRef('sheet_editors'), html`${editors ? html`Maintained by: ${editors.map(editor => html`
${editor}
`)}` : ''}`) getRef('sheet_description').textContent = description; - let blockEditingID = (!floGlobals.isSubAdmin && (editors || true)); let addLogRow = null //Add input fields if writable if (isWriteable && !lazyLoad) { + const blockEditingID = editors ? false: !floGlobals.isSubAdmin; addLogRow = html` ${html``} diff --git a/scripts/logsheet.js b/scripts/logsheet.js index 205511e..c2291cd 100644 --- a/scripts/logsheet.js +++ b/scripts/logsheet.js @@ -103,12 +103,16 @@ logSheet.enterLog = function (sheet_id, floID, log) { return new Promise((resolve, reject) => { if (floGlobals.appObjects.logSheet.sheetList[sheet_id].editors) { + // private sheet constraints if (!floGlobals.appObjects.logSheet.sheetList[sheet_id].editors.includes(floDapps.user.id)) return reject("Only editors can update logs"); - else if (!(floID in floGlobals.appObjects.logSheet.personDetails)) - return reject("floID not found"); - } else if (!floGlobals.subAdmins.includes(floDapps.user.id) && floID != floDapps.user.id) - return reject("Public authorized to log their own floID only"); + /*else if (!(floID in floGlobals.appObjects.logSheet.personDetails)) + return reject("floID not found");*/ + } else { + //public sheet constraint + if (!floGlobals.subAdmins.includes(floDapps.user.id) && floID != floDapps.user.id) + return reject("Public authorized to log their own floID only"); + } floCloudAPI.sendGeneralData({ floID, log