mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-25 18:25:42 +08:00
refs #751, hint of how data are published
* user object in stash components * publish button text changed to reflect user`s rights * User object in form read only
This commit is contained in:
committed by
Roland Winklmeier
parent
23ccb35ed8
commit
7330ccba1b
@@ -79,6 +79,7 @@ namespace BlackGui
|
|||||||
this->enableButtonRow();
|
this->enableButtonRow();
|
||||||
|
|
||||||
connect(sApp->getWebDataServices()->getDatabaseWriter(), &CDatabaseWriter::publishedModels, this, &CDbStashComponent::ps_publishedModelsResponse);
|
connect(sApp->getWebDataServices()->getDatabaseWriter(), &CDatabaseWriter::publishedModels, this, &CDbStashComponent::ps_publishedModelsResponse);
|
||||||
|
this->ps_userChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
CDbStashComponent::~CDbStashComponent()
|
CDbStashComponent::~CDbStashComponent()
|
||||||
@@ -364,9 +365,9 @@ namespace BlackGui
|
|||||||
ui->pb_AirlineIcao->setEnabled(e);
|
ui->pb_AirlineIcao->setEnabled(e);
|
||||||
ui->pb_Distributor->setEnabled(e);
|
ui->pb_Distributor->setEnabled(e);
|
||||||
ui->pb_Livery->setEnabled(e);
|
ui->pb_Livery->setEnabled(e);
|
||||||
ui->pb_Publish->setEnabled(e);
|
|
||||||
ui->pb_Unstash->setEnabled(e);
|
ui->pb_Unstash->setEnabled(e);
|
||||||
ui->pb_Validate->setEnabled(e);
|
ui->pb_Validate->setEnabled(e);
|
||||||
|
this->ps_userChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
const CLogCategoryList &CDbStashComponent::validationCategories() const
|
const CLogCategoryList &CDbStashComponent::validationCategories() const
|
||||||
@@ -398,6 +399,11 @@ namespace BlackGui
|
|||||||
return ownModel;
|
return ownModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CAuthenticatedUser CDbStashComponent::getSwiftDbUser() const
|
||||||
|
{
|
||||||
|
return this->m_swiftDbUser.get();
|
||||||
|
}
|
||||||
|
|
||||||
CAircraftModel CDbStashComponent::consolidateModel(const CAircraftModel &model) const
|
CAircraftModel CDbStashComponent::consolidateModel(const CAircraftModel &model) const
|
||||||
{
|
{
|
||||||
CAircraftModel stashModel(model);
|
CAircraftModel stashModel(model);
|
||||||
@@ -451,6 +457,29 @@ namespace BlackGui
|
|||||||
this->enableButtonRow();
|
this->enableButtonRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CDbStashComponent::ps_userChanged()
|
||||||
|
{
|
||||||
|
const CAuthenticatedUser user(this->getSwiftDbUser());
|
||||||
|
if (!user.isAuthenticated())
|
||||||
|
{
|
||||||
|
ui->pb_Publish->setText("Publish (login)");
|
||||||
|
ui->pb_Publish->setToolTip("Login first");
|
||||||
|
ui->pb_Publish->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (user.canDirectlyWriteModels())
|
||||||
|
{
|
||||||
|
ui->pb_Publish->setText("Publish (admin)");
|
||||||
|
ui->pb_Publish->setToolTip("Models directly released");
|
||||||
|
ui->pb_Publish->setEnabled(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->pb_Publish->setText("Publish (user)");
|
||||||
|
ui->pb_Publish->setToolTip("Models published as change request");
|
||||||
|
ui->pb_Publish->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CDbStashComponent::showMessages(const CStatusMessageList &msgs, bool onlyErrors, int timeoutMs)
|
bool CDbStashComponent::showMessages(const CStatusMessageList &msgs, bool onlyErrors, int timeoutMs)
|
||||||
{
|
{
|
||||||
if (msgs.isEmpty()) { return false; }
|
if (msgs.isEmpty()) { return false; }
|
||||||
|
|||||||
@@ -15,8 +15,10 @@
|
|||||||
#include "blackgui/blackguiexport.h"
|
#include "blackgui/blackguiexport.h"
|
||||||
#include "blackgui/components/dbmappingcomponentaware.h"
|
#include "blackgui/components/dbmappingcomponentaware.h"
|
||||||
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
#include "blackgui/components/enablefordockwidgetinfoarea.h"
|
||||||
|
#include "blackcore/data/authenticateduser.h"
|
||||||
#include "blackmisc/aviation/airlineicaocode.h"
|
#include "blackmisc/aviation/airlineicaocode.h"
|
||||||
#include "blackmisc/propertyindexvariantmap.h"
|
#include "blackmisc/propertyindexvariantmap.h"
|
||||||
|
#include "blackmisc/network/authenticateduser.h"
|
||||||
#include "blackmisc/simulation/aircraftmodel.h"
|
#include "blackmisc/simulation/aircraftmodel.h"
|
||||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||||
#include "blackmisc/simulation/distributor.h"
|
#include "blackmisc/simulation/distributor.h"
|
||||||
@@ -160,8 +162,12 @@ namespace BlackGui
|
|||||||
//! Row count changed
|
//! Row count changed
|
||||||
void ps_onRowCountChanged(int number, bool filter);
|
void ps_onRowCountChanged(int number, bool filter);
|
||||||
|
|
||||||
|
//! User has been changed
|
||||||
|
void ps_userChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<Ui::CDbStashComponent> ui;
|
QScopedPointer<Ui::CDbStashComponent> ui;
|
||||||
|
BlackMisc::CDataReadOnly<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser {this, &CDbStashComponent::ps_userChanged}; //!< authenticated user
|
||||||
|
|
||||||
//! Display messages
|
//! Display messages
|
||||||
bool showMessages(const BlackMisc::CStatusMessageList &msgs, bool onlyErrors = false, int timeoutMs = -1);
|
bool showMessages(const BlackMisc::CStatusMessageList &msgs, bool onlyErrors = false, int timeoutMs = -1);
|
||||||
@@ -192,6 +198,9 @@ namespace BlackGui
|
|||||||
|
|
||||||
//! Consolidate with own models (if available). This updates mostly with model description, path etc.
|
//! Consolidate with own models (if available). This updates mostly with model description, path etc.
|
||||||
BlackMisc::Simulation::CAircraftModel consolidateWithOwnModels(const BlackMisc::Simulation::CAircraftModel &model) const;
|
BlackMisc::Simulation::CAircraftModel consolidateWithOwnModels(const BlackMisc::Simulation::CAircraftModel &model) const;
|
||||||
|
|
||||||
|
//! Authenticated DB user
|
||||||
|
BlackMisc::Network::CAuthenticatedUser getSwiftDbUser() const;
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
} // ns
|
} // ns
|
||||||
|
|||||||
@@ -32,9 +32,9 @@ namespace BlackGui
|
|||||||
return CStatusMessageList();
|
return CStatusMessageList();
|
||||||
}
|
}
|
||||||
|
|
||||||
const CAuthenticatedUser &CForm::getSwiftDbUser() const
|
CAuthenticatedUser CForm::getSwiftDbUser() const
|
||||||
{
|
{
|
||||||
return this->m_swiftDbUser.getThreadLocal();
|
return this->m_swiftDbUser.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CForm::ps_userChanged()
|
void CForm::ps_userChanged()
|
||||||
|
|||||||
@@ -54,11 +54,11 @@ namespace BlackGui
|
|||||||
bool isReadOnly() const { return m_readOnly; }
|
bool isReadOnly() const { return m_readOnly; }
|
||||||
|
|
||||||
//! Authenticated DB user
|
//! Authenticated DB user
|
||||||
const BlackMisc::Network::CAuthenticatedUser &getSwiftDbUser() const;
|
BlackMisc::Network::CAuthenticatedUser getSwiftDbUser() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_readOnly = false; //!< read only
|
bool m_readOnly = false; //!< read only
|
||||||
BlackMisc::CData<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser {this, &CForm::ps_userChanged}; //!< authenticated user
|
BlackMisc::CDataReadOnly<BlackCore::Data::TAuthenticatedDbUser> m_swiftDbUser {this, &CForm::ps_userChanged}; //!< authenticated user
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
//! User has been changed
|
//! User has been changed
|
||||||
|
|||||||
Reference in New Issue
Block a user