Skip to content

Commit

Permalink
remove enforceWritePermission toggle - logic changes
Browse files Browse the repository at this point in the history
  • Loading branch information
jgraff2 committed Jul 12, 2017
1 parent 7bef895 commit 0017ec8
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions api/v1/controllers/samples.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,18 +231,18 @@ module.exports = {
}

return authUtils.getUser(req)
.then((user) => { // upsert with found user
return doUpsert(user)
.catch((err) => { // user does not have write permission for the sample
u.handleError(next, err, helper.modelName);
});
})
.catch(() => { // user is not found. upsert anyway with no user
return doUpsert(false)
.catch((err) => { // the sample is write protected
u.handleError(next, err, helper.modelName);
});
});
.then((user) => // upsert with found user
doUpsert(user)
.catch((err) => // user does not have write permission for the sample
u.handleError(next, err, helper.modelName)
)
)
.catch(() => // user is not found. upsert anyway with no user
doUpsert(false)
.catch((err) => // the sample is write protected
u.handleError(next, err, helper.modelName)
)
);
},

/**
Expand Down Expand Up @@ -319,18 +319,18 @@ module.exports = {
}

return authUtils.getUser(req)
.then((user) => { // upsert with found user
return bulkUpsert(user)
.catch((err) => { // user does not have write permission for the sample
u.handleError(next, err, helper.modelName);
});
})
.catch(() => { // user is not found. upsert anyway with no user
return bulkUpsert(false)
.catch((err) => { // the sample is write protected
u.handleError(next, err, helper.modelName);
});
});
.then((user) => // upsert with found user
bulkUpsert(user)
.catch((err) => // user does not have write permission for the sample
u.handleError(next, err, helper.modelName)
)
)
.catch(() => // user is not found. upsert anyway with no user
bulkUpsert(false)
.catch((err) => // the sample is write protected
u.handleError(next, err, helper.modelName)
)
);
},

/**
Expand Down

0 comments on commit 0017ec8

Please sign in to comment.