Make permissionTest() throw an error on fail. Having to remember to check the value scares me too much.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3960 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
parent
4525ee9cca
commit
8edc9aaa63
14
core/core.js
14
core/core.js
@ -215,7 +215,7 @@ async function getProcessBlob(blobId, key, options) {
|
||||
if (gGlobalSettings.userPermissions[user][options.packageOwner][options.packageName][permission]) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
throw Error(`Permission denied: ${permission}.`);
|
||||
}
|
||||
|
||||
} else {
|
||||
@ -227,13 +227,11 @@ async function getProcessBlob(blobId, key, options) {
|
||||
return true;
|
||||
} else if (value == 'deny') {
|
||||
storePermission(user, options.packageOwner, options.packageName, permission, false);
|
||||
return false;
|
||||
throw Error(`Permission denied: ${permission}.`);
|
||||
} else if (value == 'deny once') {
|
||||
return false;
|
||||
throw Error(`Permission denied: ${permission}.`);
|
||||
}
|
||||
return false;
|
||||
}).catch(function() {
|
||||
return false;
|
||||
throw Error(`Permission denied: ${permission}.`);
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -296,10 +294,8 @@ async function getProcessBlob(blobId, key, options) {
|
||||
if (process.credentials &&
|
||||
process.credentials.session &&
|
||||
process.credentials.session.name) {
|
||||
return imports.core.permissionTest('ssb_append').then(function(value) {
|
||||
if (value) {
|
||||
return imports.core.permissionTest('ssb_append').then(function() {
|
||||
return ssb.appendMessageWithIdentity(process.credentials.session.name, id, message);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user