Allow trustedIDs to grade records

This commit is contained in:
sairajzero 2023-05-02 20:20:09 +05:30
parent eb18247767
commit b71d7609a3
2 changed files with 4 additions and 3 deletions

View File

@ -75,6 +75,7 @@
logSheet.init().then(result => {
console.log(result)
floGlobals.isSubAdmin = floGlobals.subAdmins.includes(myFloID)
floGlobals.isTrustedID = floGlobals.trustedIDs.includes(myFloID)
hideLoader()
showPage(window.location.hash, { firstLoad: true })
//display add buttons if subAdmin, else hide
@ -1345,7 +1346,7 @@
return `by ${floID} (${time})`
}
const createGradeField = (grade) => {
const isDisabled = (!isWriteable || !floGlobals.isSubAdmin)
const isDisabled = (!isWriteable || (!floGlobals.isSubAdmin && !floGlobals.isTrustedID))
return html`<input type="number" class="grade-input" min="0" max="100" value=${grade} ?disabled=${isDisabled}>`
}
for (let i = startingIndex; i < endingIndex; i++) {

View File

@ -126,8 +126,8 @@
logSheet.gradeLog = function (sheet_id, vc, grade) {
return new Promise((resolve, reject) => {
//reject if user is not subAdmin or editor
if (!floGlobals.subAdmins.includes(floDapps.user.id))
return reject("Only subAdmins can grade logs")
if (!floGlobals.subAdmins.includes(floDapps.user.id) && !floGlobals.trustedIDs.includes(floDapps.user.id))
return reject("Only subAdmins/trustedIDs can grade logs")
let log = floGlobals.generalDataset(TYPE_SHEET_ENTRY, {
receiverID: sheet_id