mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 09:17:08 +00:00
Bypass permissions check on info.put() if role is null.
The comparison is strict non-equality so a null role cannot be forced via the API. The need for this is so that we can reuse this function to save QC results, which is something that does not take place over the API.
This commit is contained in:
@@ -3,9 +3,9 @@ const checkPermission = require('./check-permission');
|
||||
|
||||
async function put (projectId, path, payload, opts = {}, role) {
|
||||
const client = await setSurvey(projectId);
|
||||
const [key, ...jsonpath] = (path||"").split("/").filter(i => i.length);
|
||||
const [key, ...jsonpath] = (path??"").split("/").filter(i => i.length);
|
||||
|
||||
if (!checkPermission(key, "put", role)) {
|
||||
if (role !== null && !checkPermission(key, "put", role)) {
|
||||
throw {status: 403, message: "Forbidden"};
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user