Skip to content

Commit

Permalink
Use getPublishInvestigations on GUI instead of myData. Refs #9223.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Apr 1, 2014
1 parent ed57305 commit 7b210cc
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Code/Mantid/MantidQt/CustomDialogs/src/CatalogPublishDialog.cpp
Expand Up @@ -3,6 +3,7 @@
#include "MantidAPI/CatalogFactory.h"
#include "MantidAPI/CatalogManager.h"
#include "MantidAPI/ICatalog.h"
#include "MantidAPI/ICatalogInfoService.h"
#include "MantidAPI/WorkspaceFactory.h"
#include "MantidKernel/ConfigService.h"
#include "MantidKernel/FacilityInfo.h"
Expand Down Expand Up @@ -58,8 +59,17 @@ namespace MantidQt
{
auto workspace = Mantid::API::WorkspaceFactory::Instance().createTable();
auto session = Mantid::API::CatalogManager::Instance().getActiveSessions();
// Obtain the investigations that the user can publish to for all their catalogs.
if (!session.empty()) Mantid::API::CatalogManager::Instance().getCatalog("")->myData(workspace);

if (!session.empty())
{
// Cast a catalog to a catalogInfoService to access downloading functionality.
auto catalogInfoService = boost::dynamic_pointer_cast<Mantid::API::ICatalogInfoService>(
Mantid::API::CatalogManager::Instance().getCatalog(session.front()->getSessionId()));
// Check if the catalog created supports publishing functionality.
if (!catalogInfoService) throw std::runtime_error("The catalog that you are using does not support publishing.");
// Populate the workspace with investigations that the user has CREATE access to.
workspace = catalogInfoService->getPublishInvestigations();
}

// The user is not an investigator on any investigations and cannot publish
// or they are not logged into the catalog then update the related message..
Expand Down

0 comments on commit 7b210cc

Please sign in to comment.