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'; 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>`)}` : ''}`) renderElem(getRef('sheet_editors'), html`${editors ? html`Maintained by: ${editors.map(editor => html`<div class="editor">${editor}</div>`)}` : ''}`)
getRef('sheet_description').textContent = description; getRef('sheet_description').textContent = description;
let blockEditingID = (!floGlobals.isSubAdmin && (editors || true));
let addLogRow = null let addLogRow = null
//Add input fields if writable //Add input fields if writable
if (isWriteable && !lazyLoad) { if (isWriteable && !lazyLoad) {
const blockEditingID = editors ? false: !floGlobals.isSubAdmin;
addLogRow = html` addLogRow = html`
<tr> <tr>
<td>${html`<input form="new-log" class="log-input" style="width: 22rem" value=${blockEditingID ? myFloID : ''} ?readonly=${blockEditingID}>`}</td> <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) { logSheet.enterLog = function (sheet_id, floID, log) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (floGlobals.appObjects.logSheet.sheetList[sheet_id].editors) { if (floGlobals.appObjects.logSheet.sheetList[sheet_id].editors) {
// private sheet constraints
if (!floGlobals.appObjects.logSheet.sheetList[sheet_id].editors.includes(floDapps.user.id)) if (!floGlobals.appObjects.logSheet.sheetList[sheet_id].editors.includes(floDapps.user.id))
return reject("Only editors can update logs"); return reject("Only editors can update logs");
else if (!(floID in floGlobals.appObjects.logSheet.personDetails)) /*else if (!(floID in floGlobals.appObjects.logSheet.personDetails))
return reject("floID not found"); return reject("floID not found");*/
} else if (!floGlobals.subAdmins.includes(floDapps.user.id) && floID != floDapps.user.id) } else {
return reject("Public authorized to log their own floID only"); //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({ floCloudAPI.sendGeneralData({
floID, floID,
log log