mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-16 18:35:35 +08:00
refs #769, use role bulk to decide if user can directly write models
* renamed role functions * renamed buttons * some formatting
This commit is contained in:
committed by
Mathew Sutcliffe
parent
3a7c9626d3
commit
7446ffcb80
@@ -151,7 +151,7 @@
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gl_SwiftDB">
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<spacer name="vs_SwiftDb">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace BlackGui
|
||||
ui(new Ui::CDbDebugDatabaseSetup)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
bool enabled = sGui->isRunningInDeveloperEnvironment();
|
||||
const bool enabled = sGui->isRunningInDeveloperEnvironment();
|
||||
this->setEnabled(enabled);
|
||||
if (!enabled)
|
||||
{
|
||||
|
||||
@@ -48,9 +48,13 @@ namespace BlackGui
|
||||
QString html = ui->tbr_InfoAndHints->toHtml();
|
||||
html = html.replace("##swiftDB##", url.getFullUrl(), Qt::CaseInsensitive);
|
||||
html = html.replace("##swiftEnableSSO##", url.getFullUrl(), Qt::CaseInsensitive);
|
||||
|
||||
ui->tbr_InfoAndHints->setHtml(html);
|
||||
ui->tbr_InfoAndHints->setOpenExternalLinks(true);
|
||||
|
||||
const bool devEnv = sGui->isRunningInDeveloperEnvironment();
|
||||
ui->comp_DebugSetup->setVisible(devEnv);
|
||||
|
||||
connect(ui->pb_Login, &QPushButton::clicked, this, &CDbLoginComponent::ps_onLoginClicked);
|
||||
connect(ui->pb_Logoff, &QPushButton::clicked, this, &CDbLoginComponent::ps_onLogoffClicked);
|
||||
connect(&m_loginService, &CDatabaseAuthenticationService::userAuthenticationFinished, this, &CDbLoginComponent::ps_AuthenticationFinished);
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace BlackGui
|
||||
~CDbLoginComponent();
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CDbLoginComponent> ui;
|
||||
QScopedPointer<Ui::CDbLoginComponent> ui;
|
||||
BlackCore::Db::CDatabaseAuthenticationService m_loginService {this}; //!< login service
|
||||
|
||||
//! Overlay messages
|
||||
|
||||
@@ -108,10 +108,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_Password">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="le_Password">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::PasswordEchoOnEdit</enum>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>password</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -138,16 +144,10 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="le_Password">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::PasswordEchoOnEdit</enum>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string>password</string>
|
||||
</property>
|
||||
<property name="clearButtonEnabled">
|
||||
<bool>true</bool>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lbl_Password">
|
||||
<property name="text">
|
||||
<string>Password:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -156,11 +156,24 @@
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<spacer name="vs_FrameLogin">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace BlackGui
|
||||
|
||||
void CDbMappingComponent::initVPilotLoading()
|
||||
{
|
||||
this->m_vPilotEnabled = this->vPilotSupport && this->m_swiftDbUser.get().isMappingAdmin();
|
||||
this->m_vPilotEnabled = this->vPilotSupport && this->m_swiftDbUser.get().hasAdminRole();
|
||||
static const QString tabName(ui->tw_ModelsToBeMapped->tabText(TabVPilot));
|
||||
|
||||
if (this->m_vPilot1stInit && vPilotSupport)
|
||||
|
||||
@@ -475,13 +475,13 @@ namespace BlackGui
|
||||
}
|
||||
else if (user.canDirectlyWriteModels())
|
||||
{
|
||||
ui->pb_Publish->setText("Publish (admin)");
|
||||
ui->pb_Publish->setText("Publish (direct)");
|
||||
ui->pb_Publish->setToolTip("Models directly released");
|
||||
ui->pb_Publish->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->pb_Publish->setText("Publish (user)");
|
||||
ui->pb_Publish->setText("Publish (CR)");
|
||||
ui->pb_Publish->setToolTip("Models published as change request");
|
||||
ui->pb_Publish->setEnabled(true);
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace BlackGui
|
||||
void CModelMappingForm::ps_userChanged()
|
||||
{
|
||||
const CAuthenticatedUser user(this->getSwiftDbUser());
|
||||
if (user.isAdmin())
|
||||
if (user.hasAdminRole())
|
||||
{
|
||||
ui->selector_ModelMode->setValue(CAircraftModel::Include);
|
||||
ui->selector_ModelMode->setReadOnly(false);
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace BlackGui
|
||||
void CModelMappingModifyForm::ps_userChanged()
|
||||
{
|
||||
const CAuthenticatedUser user(this->getSwiftDbUser());
|
||||
if (user.isAdmin())
|
||||
if (user.hasAdminRole())
|
||||
{
|
||||
ui->selector_ModeSelector->setValue(CAircraftModel::Include);
|
||||
ui->selector_ModeSelector->setReadOnly(false);
|
||||
|
||||
@@ -98,19 +98,24 @@ namespace BlackMisc
|
||||
return msgs;
|
||||
}
|
||||
|
||||
bool CAuthenticatedUser::isAdmin() const
|
||||
bool CAuthenticatedUser::hasAdminRole() const
|
||||
{
|
||||
return this->hasRole("ADMIN");
|
||||
}
|
||||
|
||||
bool CAuthenticatedUser::isMappingAdmin() const
|
||||
bool CAuthenticatedUser::hasMappingAdminRole() const
|
||||
{
|
||||
return this->hasRole("MAPPINGADMIN") || this->isAdmin();
|
||||
return this->hasRole("MAPPINGADMIN");
|
||||
}
|
||||
|
||||
bool CAuthenticatedUser::hasBulkRole() const
|
||||
{
|
||||
return this->hasRole("BULK");
|
||||
}
|
||||
|
||||
bool CAuthenticatedUser::canDirectlyWriteModels() const
|
||||
{
|
||||
return this->isAdmin() || this->isMappingAdmin();
|
||||
return this->hasBulkRole();
|
||||
}
|
||||
|
||||
CIcon CAuthenticatedUser::toIcon() const
|
||||
|
||||
@@ -129,10 +129,13 @@ namespace BlackMisc
|
||||
void setCountry(const BlackMisc::CCountry &country) { m_country = country; }
|
||||
|
||||
//! Admin?
|
||||
bool isAdmin() const;
|
||||
bool hasAdminRole() const;
|
||||
|
||||
//! Admin?
|
||||
bool isMappingAdmin() const;
|
||||
bool hasMappingAdminRole() const;
|
||||
|
||||
//! Has bulk role?
|
||||
bool hasBulkRole() const;
|
||||
|
||||
//! Authenticated
|
||||
void setAuthenticated(bool authenticated) { m_authenticated = authenticated; }
|
||||
|
||||
Reference in New Issue
Block a user