2021-07-14 Fred Gleason <fredg@paravelsystems.com>

* Modified the login dialog for rdadmin(1) to use persistent
	placement.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-07-14 19:13:39 -04:00
parent ad9e466df9
commit a99dc99d28
2 changed files with 37 additions and 33 deletions

View File

@ -22049,3 +22049,6 @@
* Removed the 'RDTimeEvent' class. * Removed the 'RDTimeEvent' class.
2021-07-14 Fred Gleason <fredg@paravelsystems.com> 2021-07-14 Fred Gleason <fredg@paravelsystems.com>
* Restored the ability to post to RSS feeds in rdcatch(1). * Restored the ability to post to RSS feeds in rdcatch(1).
2021-07-14 Fred Gleason <fredg@paravelsystems.com>
* Modified the login dialog for rdadmin(1) to use persistent
placement.

View File

@ -92,29 +92,8 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
setWindowTitle(QString("RDAdmin v")+VERSION+" - "+ setWindowTitle(QString("RDAdmin v")+VERSION+" - "+
tr("Host")+": "+rda->config()->stationName()); tr("Host")+": "+rda->config()->stationName());
rda->ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password()); rda->
ripc()->connectHost("localhost",RIPCD_TCP_PORT,rda->config()->password());
//
// Log In
//
Login *login=new Login(&admin_username,&admin_password,this);
if(!login->exec()) {
exit(0);
}
rda->user()->setName(admin_username);
bool config_priv=rda->user()->adminConfig();
bool rss_priv=rda->user()->adminRss();
if(!rda->user()->checkPassword(admin_password,false)) {
QMessageBox::warning(this,"Login Failed","Login Failed!.\n");
exit(1);
}
else {
if((!config_priv)&&(!rss_priv)) {
QMessageBox::warning(this,tr("Insufficient Priviledges"),
tr("This account has insufficient priviledges for this operation."));
exit(1);
}
}
// //
// Cart Dialog // Cart Dialog
@ -144,7 +123,6 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
users_button->setGeometry(10,50,80,60); users_button->setGeometry(10,50,80,60);
users_button->setFont(buttonFont()); users_button->setFont(buttonFont());
users_button->setText(tr("Manage\nUsers")); users_button->setText(tr("Manage\nUsers"));
users_button->setEnabled(config_priv);
connect(users_button,SIGNAL(clicked()),this,SLOT(manageUsersData())); connect(users_button,SIGNAL(clicked()),this,SLOT(manageUsersData()));
// //
@ -154,7 +132,6 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
groups_button->setGeometry(10,120,80,60); groups_button->setGeometry(10,120,80,60);
groups_button->setFont(buttonFont()); groups_button->setFont(buttonFont());
groups_button->setText(tr("Manage\nGroups")); groups_button->setText(tr("Manage\nGroups"));
groups_button->setEnabled(config_priv);
connect(groups_button,SIGNAL(clicked()),this,SLOT(manageGroupsData())); connect(groups_button,SIGNAL(clicked()),this,SLOT(manageGroupsData()));
// //
@ -164,7 +141,6 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
services_button->setGeometry(100,50,80,60); services_button->setGeometry(100,50,80,60);
services_button->setFont(buttonFont()); services_button->setFont(buttonFont());
services_button->setText(tr("Manage\nServices")); services_button->setText(tr("Manage\nServices"));
services_button->setEnabled(config_priv);
connect(services_button,SIGNAL(clicked()),this,SLOT(manageServicesData())); connect(services_button,SIGNAL(clicked()),this,SLOT(manageServicesData()));
// //
@ -174,7 +150,6 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
stations_button->setGeometry(100,120,80,60); stations_button->setGeometry(100,120,80,60);
stations_button->setFont(buttonFont()); stations_button->setFont(buttonFont());
stations_button->setText(tr("Manage\nHosts")); stations_button->setText(tr("Manage\nHosts"));
stations_button->setEnabled(config_priv);
connect(stations_button,SIGNAL(clicked()),this,SLOT(manageStationsData())); connect(stations_button,SIGNAL(clicked()),this,SLOT(manageStationsData()));
// //
@ -184,7 +159,6 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
reports_button->setGeometry(190,50,80,60); reports_button->setGeometry(190,50,80,60);
reports_button->setFont(buttonFont()); reports_button->setFont(buttonFont());
reports_button->setText(tr("Manage\nReports")); reports_button->setText(tr("Manage\nReports"));
reports_button->setEnabled(config_priv);
connect(reports_button,SIGNAL(clicked()),this,SLOT(reportsData())); connect(reports_button,SIGNAL(clicked()),this,SLOT(reportsData()));
// //
@ -194,7 +168,6 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
podcasts_button->setGeometry(280,50,80,60); podcasts_button->setGeometry(280,50,80,60);
podcasts_button->setFont(buttonFont()); podcasts_button->setFont(buttonFont());
podcasts_button->setText(tr("Manage\nFeeds")); podcasts_button->setText(tr("Manage\nFeeds"));
podcasts_button->setEnabled(config_priv||rss_priv);
connect(podcasts_button,SIGNAL(clicked()),this,SLOT(podcastsData())); connect(podcasts_button,SIGNAL(clicked()),this,SLOT(podcastsData()));
// //
@ -204,7 +177,6 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
system_button->setGeometry(190,120,80,60); system_button->setGeometry(190,120,80,60);
system_button->setFont(buttonFont()); system_button->setFont(buttonFont());
system_button->setText(tr("System\nSettings")); system_button->setText(tr("System\nSettings"));
system_button->setEnabled(config_priv);
connect(system_button,SIGNAL(clicked()),this,SLOT(systemSettingsData())); connect(system_button,SIGNAL(clicked()),this,SLOT(systemSettingsData()));
// //
@ -214,7 +186,6 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
schedcodes_button->setGeometry(280,120,80,60); schedcodes_button->setGeometry(280,120,80,60);
schedcodes_button->setFont(buttonFont()); schedcodes_button->setFont(buttonFont());
schedcodes_button->setText(tr("Scheduler\nCodes")); schedcodes_button->setText(tr("Scheduler\nCodes"));
schedcodes_button->setEnabled(config_priv);
connect(schedcodes_button,SIGNAL(clicked()),this,SLOT(manageSchedCodes())); connect(schedcodes_button,SIGNAL(clicked()),this,SLOT(manageSchedCodes()));
// //
@ -224,7 +195,6 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
repl_button->setGeometry(100,190,80,60); repl_button->setGeometry(100,190,80,60);
repl_button->setFont(buttonFont()); repl_button->setFont(buttonFont());
repl_button->setText(tr("Manage\nReplicators")); repl_button->setText(tr("Manage\nReplicators"));
repl_button->setEnabled(config_priv);
connect(repl_button,SIGNAL(clicked()),this,SLOT(manageReplicatorsData())); connect(repl_button,SIGNAL(clicked()),this,SLOT(manageReplicatorsData()));
// //
@ -234,7 +204,6 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
info_button->setGeometry(190,190,80,60); info_button->setGeometry(190,190,80,60);
info_button->setFont(buttonFont()); info_button->setFont(buttonFont());
info_button->setText(tr("System\nInfo")); info_button->setText(tr("System\nInfo"));
info_button->setEnabled(config_priv||rss_priv);
connect(info_button,SIGNAL(clicked()),this,SLOT(systemInfoData())); connect(info_button,SIGNAL(clicked()),this,SLOT(systemInfoData()));
// //
@ -247,6 +216,38 @@ MainWidget::MainWidget(RDConfig *config,RDWidget *parent)
connect(quit_button,SIGNAL(clicked()),this,SLOT(quitMainWidget())); connect(quit_button,SIGNAL(clicked()),this,SLOT(quitMainWidget()));
loadSettings(true); loadSettings(true);
//
// Log In
//
Login *login=new Login(&admin_username,&admin_password,this);
if(!login->exec()) {
exit(0);
}
rda->user()->setName(admin_username);
bool config_priv=rda->user()->adminConfig();
bool rss_priv=rda->user()->adminRss();
if(!rda->user()->checkPassword(admin_password,false)) {
QMessageBox::warning(this,"Login Failed","Login Failed!.\n");
exit(1);
}
else {
if((!config_priv)&&(!rss_priv)) {
QMessageBox::warning(this,tr("Insufficient Priviledges"),
tr("This account has insufficient priviledges for this operation."));
exit(1);
}
}
users_button->setEnabled(config_priv);
groups_button->setEnabled(config_priv);
services_button->setEnabled(config_priv);
stations_button->setEnabled(config_priv);
reports_button->setEnabled(config_priv);
podcasts_button->setEnabled(config_priv||rss_priv);
system_button->setEnabled(config_priv);
schedcodes_button->setEnabled(config_priv);
repl_button->setEnabled(config_priv);
info_button->setEnabled(config_priv||rss_priv);
} }