Removed constraint

- Constraint: personDetails required for adding logs in private sheets
This commit is contained in:
sairajzero 2022-11-27 18:36:11 +05:30
parent 1a910bd6d4
commit 517391d0d3
2 changed files with 9 additions and 5 deletions

View File

@ -1276,10 +1276,10 @@
getRef('sheet_type').textContent = editors ? 'Private' : 'Public';
renderElem(getRef('sheet_editors'), html`${editors ? html`Maintained by: ${editors.map(editor => html`<div class="editor">${editor}</div>`)}` : ''}`)
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`
<tr>
<td>${html`<input form="new-log" class="log-input" style="width: 22rem" value=${blockEditingID ? myFloID : ''} ?readonly=${blockEditingID}>`}</td>

View File

@ -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