Skip to content

Commit

Permalink
WB-818 Upload Scene File to BALSA - Verify user is owner and study is…
Browse files Browse the repository at this point in the history
… editable: Disable logic in wb_view that tests for study editable and owned by user as this logic will be moved into the BALSA database. For now, if a '403' is returned by the 'process upload' step, add to error message that this error may be caused by a permissions/ownership problem.
  • Loading branch information
John Harwell committed Aug 28, 2018
1 parent 5333ad2 commit b78a029
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
11 changes: 9 additions & 2 deletions src/GuiQt/BalsaDatabaseManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,15 @@ BalsaDatabaseManager::verifyUploadFileResponse(const std::map<AString, AString>&
AString& errorMessageOut) const
{
if (responseHttpCode != 200) {
errorMessageOut = ("Upload failed. Http Code="
+ AString::number(responseHttpCode));
if (responseHttpCode == 403) {
errorMessageOut = ("Upload failed. Http Code="
+ AString::number(responseHttpCode)
+ ". You may not have ownership/permission to edit the study.");
}
else {
errorMessageOut = ("Upload failed. Http Code="
+ AString::number(responseHttpCode));
}
return false;
}

Expand Down
19 changes: 13 additions & 6 deletions src/GuiQt/BalsaDatabaseUploadSceneFileDialog.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -922,12 +922,19 @@ BalsaDatabaseUploadSceneFileDialog::okButtonClicked()
+ "\" button to choose or create a BALSA Study ID and Title.");
}
else {
if (m_extractDirectoryNameLineEdit->hasAcceptableInput()) {
const AString studyID = m_balsaStudyIDLineEdit->text().trimmed();
AString errorMessage;
if ( ! m_balsaDatabaseManager->isStudyEditableByUser(studyID,
errorMessage)) {
msg.appendWithNewLine(errorMessage);
/*
* Note: Test of study ID for editable status will move
* into BALSA Database so disabled until that time.
*/
const bool testStudyIdEditableFlag(false);
if (testStudyIdEditableFlag) {
if (m_extractDirectoryNameLineEdit->hasAcceptableInput()) {
const AString studyID = m_balsaStudyIDLineEdit->text().trimmed();
AString errorMessage;
if ( ! m_balsaDatabaseManager->isStudyEditableByUser(studyID,
errorMessage)) {
msg.appendWithNewLine(errorMessage);
}
}
}
}
Expand Down

0 comments on commit b78a029

Please sign in to comment.