User management console now functional

master
Timothy Pearson 12 years ago
parent 941d8c3b96
commit 61dfcc04f7

@ -87,6 +87,7 @@ AC_CONFIG_FILES([ src/app/views/Makefile ])
AC_CONFIG_FILES([ src/dialogs/Makefile ]) AC_CONFIG_FILES([ src/dialogs/Makefile ])
AC_CONFIG_FILES([ src/part/Makefile ]) AC_CONFIG_FILES([ src/part/Makefile ])
AC_CONFIG_FILES([ src/part/adminconsole/Makefile ]) AC_CONFIG_FILES([ src/part/adminconsole/Makefile ])
AC_CONFIG_FILES([ src/part/adminusermgmt/Makefile ])
AC_CONFIG_FILES([ src/part/commanalyzer/Makefile ]) AC_CONFIG_FILES([ src/part/commanalyzer/Makefile ])
AC_CONFIG_FILES([ src/part/fpgaprogram/Makefile ]) AC_CONFIG_FILES([ src/part/fpgaprogram/Makefile ])
AC_CONFIG_FILES([ src/part/fpgaview/Makefile ]) AC_CONFIG_FILES([ src/part/fpgaview/Makefile ])

@ -2,10 +2,10 @@ INCLUDES = $(all_includes) -I$(top_srcdir)/src -I$(top_srcdir)/src/widgets $
KDE_CXXFLAGS = $(USE_EXCEPTIONS) KDE_CXXFLAGS = $(USE_EXCEPTIONS)
METASOURCES = AUTO METASOURCES = AUTO
KDE_ICON = libremotelab_adminconsole KDE_ICON = libremotelab_adminusermgmt
# Part # Part
kde_module_LTLIBRARIES = libremotelab_adminconsole.la kde_module_LTLIBRARIES = libremotelab_adminusermgmt.la
libremotelab_adminconsole_la_LIBADD = ../../widgets/libtracewidget.la ../../widgets/libfloatspinbox.la $(LIB_KFILE) $(LIB_KPARTS) $(LIB_TDEUI) $(LIB_QT) -ltdekrbsocket -ltqtrla libremotelab_adminusermgmt_la_LIBADD = ../../widgets/libtracewidget.la ../../widgets/libfloatspinbox.la $(LIB_KFILE) $(LIB_KPARTS) $(LIB_TDEUI) $(LIB_QT) -ltdekrbsocket -ltqtrla
libremotelab_adminconsole_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) $(LIB_TDECORE) $(LIB_TDEUI) -lkio -ltdefx libremotelab_adminusermgmt_la_LDFLAGS = $(all_libraries) $(KDE_PLUGIN) $(LIB_TDECORE) $(LIB_TDEUI) -lkio -ltdefx
libremotelab_adminconsole_la_SOURCES = part.cpp layout.ui terminatedlg.cpp terminatedlgbase.ui libremotelab_adminusermgmt_la_SOURCES = part.cpp layout.ui terminatedlg.cpp terminatedlgbase.ui

@ -1,8 +1,8 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> <!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>AdminConsoleBase</class> <class>UserManagementBase</class>
<widget class="TQWidget"> <widget class="TQWidget">
<property name="name"> <property name="name">
<cstring>AdminConsoleBase</cstring> <cstring>UserManagementBase</cstring>
</property> </property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
@ -37,7 +37,7 @@
<widget class="KListView" row="1" column="0" colspan="4"> <widget class="KListView" row="1" column="0" colspan="4">
<column> <column>
<property name="text"> <property name="text">
<string>Session ID</string> <string>Group Name</string>
</property> </property>
<property name="clickable"> <property name="clickable">
<bool>true</bool> <bool>true</bool>
@ -48,73 +48,7 @@
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>User Name</string> <string>Allowed Servers</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizeable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Server Name</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizeable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Control PID</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizeable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Window Manager PID</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizeable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>X11 Display Number</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizeable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Logon Date</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizeable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Last Session Management Activity</string>
</property> </property>
<property name="clickable"> <property name="clickable">
<bool>true</bool> <bool>true</bool>
@ -148,10 +82,26 @@
</property> </property>
<widget class="TQPushButton" row="0" column="0" colspan="1"> <widget class="TQPushButton" row="0" column="0" colspan="1">
<property name="name"> <property name="name">
<cstring>ts_buttonKill</cstring> <cstring>ts_buttonAddGroup</cstring>
</property>
<property name="text">
<string>Add Group</string>
</property>
</widget>
<widget class="TQPushButton" row="0" column="1" colspan="1">
<property name="name">
<cstring>ts_buttonModifyGroup</cstring>
</property> </property>
<property name="text"> <property name="text">
<string>Terminate Session</string> <string>Modify Group</string>
</property>
</widget>
<widget class="TQPushButton" row="0" column="2" colspan="1">
<property name="name">
<cstring>ts_buttonDeleteGroup</cstring>
</property>
<property name="text">
<string>Delete Group</string>
</property> </property>
</widget> </widget>
</grid> </grid>
@ -199,29 +149,7 @@
<widget class="KListView" row="1" column="0" colspan="4"> <widget class="KListView" row="1" column="0" colspan="4">
<column> <column>
<property name="text"> <property name="text">
<string>Session ID</string> <string>Group Name</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizeable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>User Name</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizeable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Realm Name</string>
</property> </property>
<property name="clickable"> <property name="clickable">
<bool>true</bool> <bool>true</bool>
@ -232,29 +160,7 @@
</column> </column>
<column> <column>
<property name="text"> <property name="text">
<string>Server ID</string> <string>Allowed Stations</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizeable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Logon Date</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizeable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Forced Logoff Date</string>
</property> </property>
<property name="clickable"> <property name="clickable">
<bool>true</bool> <bool>true</bool>
@ -288,18 +194,26 @@
</property> </property>
<widget class="TQPushButton" row="0" column="0" colspan="1"> <widget class="TQPushButton" row="0" column="0" colspan="1">
<property name="name"> <property name="name">
<cstring>workspace_buttonTerminate</cstring> <cstring>workspace_buttonAddGroup</cstring>
</property> </property>
<property name="text"> <property name="text">
<string>Terminate Workspace</string> <string>Add Group</string>
</property> </property>
</widget> </widget>
<widget class="TQPushButton" row="0" column="1" colspan="1"> <widget class="TQPushButton" row="0" column="1" colspan="1">
<property name="name"> <property name="name">
<cstring>workspace_buttonCancelTermination</cstring> <cstring>workspace_buttonModifyGroup</cstring>
</property>
<property name="text">
<string>Modify Group</string>
</property>
</widget>
<widget class="TQPushButton" row="0" column="2" colspan="1">
<property name="name">
<cstring>workspace_buttonDeleteGroup</cstring>
</property> </property>
<property name="text"> <property name="text">
<string>Cancel Termination</string> <string>Delete Group</string>
</property> </property>
</widget> </widget>
</grid> </grid>
@ -329,7 +243,7 @@
</grid> </grid>
</widget> </widget>
<includes> <includes>
<include location="local" impldecl="in implementation">AdminConsoleBase.ui.h</include> <include location="local" impldecl="in implementation">UserManagementBase.ui.h</include>
</includes> </includes>
<includes> <includes>
<include location="local" impldecl="in implementation">tracewidget.h</include> <include location="local" impldecl="in implementation">tracewidget.h</include>

@ -62,7 +62,8 @@
enum connectionModes { enum connectionModes {
ModeIdle = 0, ModeIdle = 0,
ModeTerminate = 1 ModeUpdate = 1,
ModeDelete = 2
}; };
enum connectionStates { enum connectionStates {
@ -71,18 +72,24 @@ enum connectionStates {
ModeIdle_StateProcessTerminalList = 2, ModeIdle_StateProcessTerminalList = 2,
ModeIdle_StateWorkspaceListRequest = 3, ModeIdle_StateWorkspaceListRequest = 3,
ModeIdle_StateProcessWorkspaceList = 4, ModeIdle_StateProcessWorkspaceList = 4,
ModeIdle_StateDelay = 5, ModeIdle_StateTerminalAuthGroupListRequest = 5,
ModeTerminate_TerminalServices = 6, ModeIdle_StateProcessTerminalAuthGroupList = 6,
ModeTerminate_LaboratoryWorkspace = 7, ModeIdle_StateWorkspaceServiceAuthGroupListRequest = 7,
ModeTerminate_CancelTerminationOfWorkspace = 8, ModeIdle_StateProcessWorkspaceServiceAuthGroupList = 8,
ModeTerminate_ProcessResponse = 9 ModeIdle_StateDelay = 9,
ModeUpdate_TerminalServices = 10,
ModeUpdate_LaboratoryWorkspace = 11,
ModeUpdate_ProcessResponse = 12,
ModeDelete_TerminalServices = 13,
ModeDelete_LaboratoryWorkspace = 14,
ModeDelete_ProcessResponse = 15
}; };
namespace RemoteLab { namespace RemoteLab {
typedef KParts::GenericFactory<RemoteLab::UserManagementPart> Factory; typedef KParts::GenericFactory<RemoteLab::UserManagementPart> Factory;
#define CLIENT_LIBRARY "libremotelab_adminconsole" #define CLIENT_LIBRARY "libremotelab_adminusermgmt"
K_EXPORT_COMPONENT_FACTORY(libremotelab_adminconsole, RemoteLab::Factory) K_EXPORT_COMPONENT_FACTORY(libremotelab_adminusermgmt, RemoteLab::Factory)
UserManagementPart::UserManagementPart(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name, const TQStringList&) UserManagementPart::UserManagementPart(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name, const TQStringList&)
: RemoteInstrumentPart( parent, name ), m_base(NULL), m_commHandlerState(0), m_connectionActiveAndValid(false), m_tickerState(0) : RemoteInstrumentPart( parent, name ), m_base(NULL), m_commHandlerState(0), m_connectionActiveAndValid(false), m_tickerState(0)
@ -109,9 +116,14 @@ UserManagementPart::UserManagementPart(TQWidget *parentWidget, const char *widge
m_base = new UserManagementBase(widget()); m_base = new UserManagementBase(widget());
// Initialize widgets // Initialize widgets
connect(m_base->ts_buttonKill, SIGNAL(clicked()), this, SLOT(terminalServiceKillButtonClicked())); connect(m_base->ts_buttonAddGroup, SIGNAL(clicked()), this, SLOT(terminalServiceAddGroupButtonClicked()));
connect(m_base->workspace_buttonTerminate, SIGNAL(clicked()), this, SLOT(workspaceTerminateButtonClicked())); connect(m_base->ts_buttonModifyGroup, SIGNAL(clicked()), this, SLOT(terminalServiceModifyGroupButtonClicked()));
connect(m_base->workspace_buttonCancelTermination, SIGNAL(clicked()), this, SLOT(workspaceCancelTerminationButtonClicked())); connect(m_base->ts_buttonDeleteGroup, SIGNAL(clicked()), this, SLOT(terminalServiceDeleteGroupButtonClicked()));
connect(m_base->workspace_buttonAddGroup, SIGNAL(clicked()), this, SLOT(workspaceAddGroupButtonClicked()));
connect(m_base->workspace_buttonModifyGroup, SIGNAL(clicked()), this, SLOT(workspaceModifyGroupButtonClicked()));
connect(m_base->workspace_buttonDeleteGroup, SIGNAL(clicked()), this, SLOT(workspaceDeleteGroupButtonClicked()));
connect(m_base->ts_list, SIGNAL(doubleClicked(TQListViewItem*, const TQPoint&, int)), this, SLOT(terminalServiceModifyGroupButtonClicked()));
connect(m_base->workspace_list, SIGNAL(doubleClicked(TQListViewItem*, const TQPoint&, int)), this, SLOT(workspaceModifyGroupButtonClicked()));
m_base->ts_list->setAllColumnsShowFocus(true); m_base->ts_list->setAllColumnsShowFocus(true);
connect(m_base->ts_list, SIGNAL(selectionChanged()), this, SLOT(terminalServiceListSelect())); connect(m_base->ts_list, SIGNAL(selectionChanged()), this, SLOT(terminalServiceListSelect()));
@ -141,25 +153,31 @@ void UserManagementPart::processLockouts() {
} }
} }
if ((m_connectionActiveAndValid == true) && (m_base->ts_list->selectedItem())) { if (m_connectionActiveAndValid == true) {
m_base->ts_buttonKill->setEnabled(true); m_base->ts_buttonAddGroup->setEnabled(true);
m_base->workspace_buttonAddGroup->setEnabled(true);
} }
else { else {
m_base->ts_buttonKill->setEnabled(false); m_base->ts_buttonAddGroup->setEnabled(false);
m_base->workspace_buttonAddGroup->setEnabled(false);
} }
if ((m_connectionActiveAndValid == true) && (m_base->workspace_list->selectedItem())) { if ((m_connectionActiveAndValid == true) && (m_base->ts_list->selectedItem())) {
m_base->workspace_buttonTerminate->setEnabled(true); m_base->ts_buttonModifyGroup->setEnabled(true);
m_base->ts_buttonDeleteGroup->setEnabled(true);
} }
else { else {
m_base->workspace_buttonTerminate->setEnabled(false); m_base->ts_buttonModifyGroup->setEnabled(false);
m_base->ts_buttonDeleteGroup->setEnabled(false);
} }
if ((m_connectionActiveAndValid == true) && (m_base->workspace_list->selectedItem())) { if ((m_connectionActiveAndValid == true) && (m_base->workspace_list->selectedItem())) {
m_base->workspace_buttonCancelTermination->setEnabled(true); m_base->workspace_buttonModifyGroup->setEnabled(true);
m_base->workspace_buttonDeleteGroup->setEnabled(true);
} }
else { else {
m_base->workspace_buttonCancelTermination->setEnabled(false); m_base->workspace_buttonModifyGroup->setEnabled(false);
m_base->workspace_buttonDeleteGroup->setEnabled(false);
} }
} }
@ -213,44 +231,171 @@ void UserManagementPart::connectionStatusChangedCallback() {
processLockouts(); processLockouts();
} }
void UserManagementPart::terminalServiceKillButtonClicked() { void UserManagementPart::terminalServiceAddGroupButtonClicked() {
GroupPermissionsDialog groupauthdlg(0);
groupauthdlg.setPermissionsSelectorLabel(i18n("Allowed Servers"));
{
TQKeyedStringList keyedServerList;
for (TQStringList::Iterator it2 = m_availableTerminalServersList.begin(); it2 != m_availableTerminalServersList.end(); ++it2) {
keyedServerList.append(TQKeyedStringPair(TQString("%1").arg(*it2), 0));
}
groupauthdlg.setAvailableServers(keyedServerList);
}
if (groupauthdlg.exec() == TQDialog::Accepted) {
m_updateTerminalServiceAuthGroupList.clear();
TerminalServiceAuthGroupType agt;
agt.groupName = groupauthdlg.groupName();
TQKeyedStringList selectedServers = groupauthdlg.selectedServers();
agt.allowedServerNames.clear();
for (TQKeyedStringList::Iterator it = selectedServers.begin(); it != selectedServers.end(); ++it) {
agt.allowedServerNames.append((*it).first);
}
m_updateTerminalServiceAuthGroupList.append(agt);
m_commHandlerNextState = ModeUpdate_TerminalServices;
m_commHandlerNextMode = ModeUpdate;
}
processLockouts();
}
void UserManagementPart::terminalServiceModifyGroupButtonClicked() {
TQListViewItem* item = m_base->ts_list->selectedItem();
GroupPermissionsDialog groupauthdlg(0);
groupauthdlg.setPermissionsSelectorLabel(i18n("Allowed Servers"));
{
TQKeyedStringList keyedServerList;
for (TQStringList::Iterator it2 = m_availableTerminalServersList.begin(); it2 != m_availableTerminalServersList.end(); ++it2) {
keyedServerList.append(TQKeyedStringPair(TQString("%1").arg(*it2), 0));
}
groupauthdlg.setAvailableServers(keyedServerList);
}
TerminalServiceAuthGroupList::iterator it = m_terminalServiceAuthGroupList.findByName(item->text(0));
if (it != m_terminalServiceAuthGroupList.end()) {
TQKeyedStringList keyedServerList;
for (TQStringList::Iterator it2 = (*it).allowedServerNames.begin(); it2 != (*it).allowedServerNames.end(); ++it2) {
keyedServerList.append(TQKeyedStringPair(TQString("%1").arg(*it2), 0));
}
groupauthdlg.setSelectedServers(keyedServerList);
}
groupauthdlg.setGroupName(item->text(0), false);
if (groupauthdlg.exec() == TQDialog::Accepted) {
m_updateTerminalServiceAuthGroupList.clear();
TerminalServiceAuthGroupType agt;
agt.groupName = groupauthdlg.groupName();
TQKeyedStringList selectedServers = groupauthdlg.selectedServers();
agt.allowedServerNames.clear();
for (TQKeyedStringList::Iterator it = selectedServers.begin(); it != selectedServers.end(); ++it) {
agt.allowedServerNames.append((*it).first);
}
m_updateTerminalServiceAuthGroupList.append(agt);
m_commHandlerNextState = ModeUpdate_TerminalServices;
m_commHandlerNextMode = ModeUpdate;
}
processLockouts();
}
void UserManagementPart::terminalServiceDeleteGroupButtonClicked() {
TQListViewItem* item = m_base->ts_list->selectedItem(); TQListViewItem* item = m_base->ts_list->selectedItem();
TerminateDialog termdlg(0); if (KMessageBox::warningYesNo(0, i18n("<qt><b>You are attempting to delete the group '%1'</b><br>You will not be able to undo this action<p>Do you wish to proceed?</qt>").arg(item->text(0)), i18n("Delete group?")) == KMessageBox::Yes) {
termdlg.setWarningLabelText(i18n("Configure termination of Terminal Services for user %1").arg(item->text(1))); m_updateTerminalServiceAuthGroupList.clear();
termdlg.enableDelayedTermination(false); TerminalServiceAuthGroupType agt;
if (termdlg.exec() == TQDialog::Accepted) { agt.groupName = item->text(0);
terminateSessionID = item->text(0); m_updateTerminalServiceAuthGroupList.append(agt);
terminateSessionDelayMinutes = termdlg.minutes(); m_commHandlerNextState = ModeDelete_TerminalServices;
m_commHandlerNextState = ModeTerminate_TerminalServices; m_commHandlerNextMode = ModeDelete;
m_commHandlerNextMode = ModeTerminate; }
processLockouts();
}
void UserManagementPart::workspaceAddGroupButtonClicked() {
GroupPermissionsDialog groupauthdlg(0);
groupauthdlg.setPermissionsSelectorLabel(i18n("Allowed Stations"));
{
TQKeyedStringList friendlyStations;
for (StationList::iterator it = m_availableWorkspaceStationsList.begin(); it != m_availableWorkspaceStationsList.end(); ++it) {
friendlyStations.append(TQKeyedStringPair(TQString("%1").arg((*it).name), (*it).id));
}
groupauthdlg.setAvailableServers(friendlyStations);
}
if (groupauthdlg.exec() == TQDialog::Accepted) {
m_updateWorkspaceServiceAuthGroupList.clear();
WorkspaceServiceAuthGroupType agt;
agt.groupName = groupauthdlg.groupName();
TQKeyedStringList selectedStations = groupauthdlg.selectedServers();
agt.allowedStationIDs.clear();
for (TQKeyedStringList::Iterator it = selectedStations.begin(); it != selectedStations.end(); ++it) {
agt.allowedStationIDs.append((*it).second);
}
m_updateWorkspaceServiceAuthGroupList.append(agt);
m_commHandlerNextState = ModeUpdate_LaboratoryWorkspace;
m_commHandlerNextMode = ModeUpdate;
} }
processLockouts(); processLockouts();
} }
void UserManagementPart::workspaceTerminateButtonClicked() { void UserManagementPart::workspaceModifyGroupButtonClicked() {
TQListViewItem* item = m_base->workspace_list->selectedItem(); TQListViewItem* item = m_base->workspace_list->selectedItem();
TerminateDialog termdlg(0); GroupPermissionsDialog groupauthdlg(0);
termdlg.setWarningLabelText(i18n("Configure termination of Laboratory Workspace for user %1").arg(item->text(1))); groupauthdlg.setPermissionsSelectorLabel(i18n("Allowed Stations"));
termdlg.enableDelayedTermination(true); {
if (termdlg.exec() == TQDialog::Accepted) { TQKeyedStringList friendlyStations;
terminateSessionID = item->text(0); for (StationList::iterator it = m_availableWorkspaceStationsList.begin(); it != m_availableWorkspaceStationsList.end(); ++it) {
terminateSessionDelayMinutes = termdlg.minutes(); friendlyStations.append(TQKeyedStringPair(TQString("%1").arg((*it).name), (*it).id));
m_commHandlerNextState = ModeTerminate_LaboratoryWorkspace; }
m_commHandlerNextMode = ModeTerminate; groupauthdlg.setAvailableServers(friendlyStations);
}
WorkspaceServiceAuthGroupList::iterator it = m_workspaceAuthGroupList.findByName(item->text(0));
if (it != m_workspaceAuthGroupList.end()) {
TQKeyedStringList friendlyStations;
for (TQInt32List::Iterator it2 = (*it).allowedStationIDs.begin(); it2 != (*it).allowedStationIDs.end(); ++it2) {
int stationID = *it2;
StationList::iterator stationInfoIterator = m_availableWorkspaceStationsList.findByID(stationID);
if (stationInfoIterator != m_availableWorkspaceStationsList.end()) {
friendlyStations.append(TQKeyedStringPair(TQString("%1").arg((*stationInfoIterator).name), (*stationInfoIterator).id));
}
else {
friendlyStations.append(TQKeyedStringPair(TQString("<unknown>"), stationID));
}
}
groupauthdlg.setSelectedServers(friendlyStations);
}
groupauthdlg.setGroupName(item->text(0), false);
if (groupauthdlg.exec() == TQDialog::Accepted) {
m_updateWorkspaceServiceAuthGroupList.clear();
WorkspaceServiceAuthGroupType agt;
agt.groupName = groupauthdlg.groupName();
TQKeyedStringList selectedStations = groupauthdlg.selectedServers();
agt.allowedStationIDs.clear();
for (TQKeyedStringList::Iterator it = selectedStations.begin(); it != selectedStations.end(); ++it) {
agt.allowedStationIDs.append((*it).second);
}
m_updateWorkspaceServiceAuthGroupList.append(agt);
m_commHandlerNextState = ModeUpdate_LaboratoryWorkspace;
m_commHandlerNextMode = ModeUpdate;
} }
processLockouts(); processLockouts();
} }
void UserManagementPart::workspaceCancelTerminationButtonClicked() { void UserManagementPart::workspaceDeleteGroupButtonClicked() {
TQListViewItem* item = m_base->workspace_list->selectedItem(); TQListViewItem* item = m_base->workspace_list->selectedItem();
terminateSessionID = item->text(0); if (KMessageBox::warningYesNo(0, i18n("<qt><b>You are attempting to delete the group '%1'</b><br>You will not be able to undo this action<p>Do you wish to proceed?</qt>").arg(item->text(0)), i18n("Delete group?")) == KMessageBox::Yes) {
m_commHandlerNextState = ModeTerminate_CancelTerminationOfWorkspace; m_updateWorkspaceServiceAuthGroupList.clear();
m_commHandlerNextMode = ModeTerminate; WorkspaceServiceAuthGroupType agt;
agt.groupName = item->text(0);
agt.allowedStationIDs.clear();
m_updateWorkspaceServiceAuthGroupList.append(agt);
m_commHandlerNextState = ModeDelete_LaboratoryWorkspace;
m_commHandlerNextMode = ModeDelete;
}
processLockouts(); processLockouts();
} }
@ -383,7 +528,7 @@ void UserManagementPart::mainEventLoop() {
// Get status of remote system // Get status of remote system
// Clear buffers to synchronize frames in case of data corruption // Clear buffers to synchronize frames in case of data corruption
m_socket->clearIncomingData(); m_socket->clearIncomingData();
ds << TQString("USERS"); ds << TQString("LIST");
ds << TQString("TERMINALS"); ds << TQString("TERMINALS");
m_socket->writeEndOfFrame(); m_socket->writeEndOfFrame();
@ -395,23 +540,89 @@ void UserManagementPart::mainEventLoop() {
PAT_WATCHDOG_TIMER PAT_WATCHDOG_TIMER
TQString status; TQString status;
TerminalServiceStatusList list;
ds >> status; ds >> status;
if (status == "OK") { if (status == "OK") {
ds >> list; ds >> m_availableTerminalServersList;
m_socket->clearFrameTail();
setTickerMessage(i18n("Connected"));
}
SET_NEXT_STATE(ModeIdle_StateWorkspaceListRequest);
EXEC_NEXT_STATE_IMMEDIATELY
}
else {
if (!m_updateTimeoutTimer->isActive()) {
UPDATEDISPLAY_TIMEOUT
}
}
break;
case ModeIdle_StateWorkspaceListRequest:
// Get status of remote system
// Clear buffers to synchronize frames in case of data corruption
m_socket->clearIncomingData();
ds << TQString("LIST");
ds << TQString("WORKSPACES");
m_socket->writeEndOfFrame();
SET_NEXT_STATE(ModeIdle_StateProcessWorkspaceList)
EXEC_NEXT_STATE_IMMEDIATELY
break;
case ModeIdle_StateProcessWorkspaceList:
// Get all data
if (m_socket->canReadFrame()) {
PAT_WATCHDOG_TIMER
TQString status;
ds >> status;
if (status == "OK") {
ds >> m_availableWorkspaceStationsList;
m_socket->clearFrameTail();
setTickerMessage(i18n("Connected"));
}
SET_NEXT_STATE(ModeIdle_StateTerminalAuthGroupListRequest);
EXEC_NEXT_STATE_IMMEDIATELY
}
else {
if (!m_updateTimeoutTimer->isActive()) {
UPDATEDISPLAY_TIMEOUT
}
}
break;
case ModeIdle_StateTerminalAuthGroupListRequest:
// Get status of remote system
// Clear buffers to synchronize frames in case of data corruption
m_socket->clearIncomingData();
ds << TQString("LISTGROUPACCESS");
ds << TQString("TERMINALS");
m_socket->writeEndOfFrame();
SET_NEXT_STATE(ModeIdle_StateProcessTerminalAuthGroupList)
break;
case ModeIdle_StateProcessTerminalAuthGroupList:
// Get all data
if (m_socket->canReadFrame()) {
PAT_WATCHDOG_TIMER
TQString status;
ds >> status;
if (status == "OK") {
ds >> m_terminalServiceAuthGroupList;
m_socket->clearFrameTail(); m_socket->clearFrameTail();
TerminalServiceStatusList::iterator it; TerminalServiceAuthGroupList::iterator it;
TQListViewItemIterator it2; TQListViewItemIterator it2;
for (it = list.begin(); it != list.end(); ++it) { for (it = m_terminalServiceAuthGroupList.begin(); it != m_terminalServiceAuthGroupList.end(); ++it) {
TerminalServiceStatusType info = *it; TerminalServiceAuthGroupType info = *it;
it2 = TQListViewItemIterator(m_base->ts_list); it2 = TQListViewItemIterator(m_base->ts_list);
bool found = false; bool found = false;
TQListViewItem* item = NULL; TQListViewItem* item = NULL;
while (it2.current()) { while (it2.current()) {
item = *it2; item = *it2;
if (info.sessionID == item->text(0).toInt()) { if (info.groupName == item->text(0)) {
found = true; found = true;
break; break;
} }
@ -420,22 +631,16 @@ void UserManagementPart::mainEventLoop() {
if (!found) { if (!found) {
item = new TQListViewItem(m_base->ts_list); item = new TQListViewItem(m_base->ts_list);
} }
item->setText(0, TQString("%1").arg(info.sessionID)); item->setText(0, TQString("%1").arg(info.groupName));
item->setText(1, info.username); item->setText(1, info.allowedServerNames.join(", "));
item->setText(2, info.serverName);
item->setText(3, TQString("%1").arg(info.serverPID));
item->setText(4, TQString("%1").arg(info.wmPID));
item->setText(5, TQString(":%1").arg(info.display));
item->setText(6, info.loginStamp.toString());
item->setText(7, info.activityStamp.toString());
} }
it2 = TQListViewItemIterator(m_base->ts_list); it2 = TQListViewItemIterator(m_base->ts_list);
while (it2.current()) { while (it2.current()) {
TQListViewItem* item = *it2; TQListViewItem* item = *it2;
bool found = false; bool found = false;
for (it = list.begin(); it != list.end(); ++it) { for (it = m_terminalServiceAuthGroupList.begin(); it != m_terminalServiceAuthGroupList.end(); ++it) {
TerminalServiceStatusType info = *it; TerminalServiceAuthGroupType info = *it;
if (info.sessionID == item->text(0).toInt()) { if (info.groupName == item->text(0)) {
found = true; found = true;
} }
} }
@ -448,7 +653,7 @@ void UserManagementPart::mainEventLoop() {
setTickerMessage(i18n("Connected")); setTickerMessage(i18n("Connected"));
} }
SET_NEXT_STATE(ModeIdle_StateWorkspaceListRequest); SET_NEXT_STATE(ModeIdle_StateWorkspaceServiceAuthGroupListRequest);
EXEC_NEXT_STATE_IMMEDIATELY EXEC_NEXT_STATE_IMMEDIATELY
} }
else { else {
@ -457,43 +662,39 @@ void UserManagementPart::mainEventLoop() {
} }
} }
break; break;
case ModeIdle_StateWorkspaceListRequest: case ModeIdle_StateWorkspaceServiceAuthGroupListRequest:
// Get status of remote system // Get status of remote system
// Clear buffers to synchronize frames in case of data corruption // Clear buffers to synchronize frames in case of data corruption
m_socket->clearIncomingData(); m_socket->clearIncomingData();
ds << TQString("USERS"); ds << TQString("LISTGROUPACCESS");
ds << TQString("WORKSPACES"); ds << TQString("WORKSPACES");
m_socket->writeEndOfFrame(); m_socket->writeEndOfFrame();
SET_NEXT_STATE(ModeIdle_StateProcessWorkspaceList) SET_NEXT_STATE(ModeIdle_StateProcessWorkspaceServiceAuthGroupList)
EXEC_NEXT_STATE_IMMEDIATELY EXEC_NEXT_STATE_IMMEDIATELY
break; break;
case ModeIdle_StateProcessWorkspaceList: case ModeIdle_StateProcessWorkspaceServiceAuthGroupList:
// Get all data // Get all data
if (m_socket->canReadFrame()) { if (m_socket->canReadFrame()) {
PAT_WATCHDOG_TIMER PAT_WATCHDOG_TIMER
TQString status; TQString status;
WorkspaceServiceStatusList list;
ds >> status; ds >> status;
if (status == "OK") { if (status == "OK") {
ds >> list; ds >> m_workspaceAuthGroupList;
m_socket->clearFrameTail(); m_socket->clearFrameTail();
WorkspaceServiceStatusList::iterator it; WorkspaceServiceAuthGroupList::iterator it;
TQListViewItemIterator it2; TQListViewItemIterator it2;
for (it = list.begin(); it != list.end(); ++it) { for (it = m_workspaceAuthGroupList.begin(); it != m_workspaceAuthGroupList.end(); ++it) {
WorkspaceServiceStatusType info = *it; WorkspaceServiceAuthGroupType info = *it;
if (info.serviceID != 0) {
continue;
}
it2 = TQListViewItemIterator(m_base->workspace_list); it2 = TQListViewItemIterator(m_base->workspace_list);
bool found = false; bool found = false;
TQListViewItem* item = NULL; TQListViewItem* item = NULL;
while (it2.current()) { while (it2.current()) {
item = *it2; item = *it2;
if (info.sessionID == item->text(0).toInt()) { if (info.groupName == item->text(0)) {
found = true; found = true;
break; break;
} }
@ -502,23 +703,27 @@ void UserManagementPart::mainEventLoop() {
if (!found) { if (!found) {
item = new TQListViewItem(m_base->workspace_list); item = new TQListViewItem(m_base->workspace_list);
} }
item->setText(0, TQString("%1").arg(info.sessionID)); item->setText(0, TQString("%1").arg(info.groupName));
item->setText(1, info.username); TQString allowedStationsText;
item->setText(2, info.realmname); TQInt32List::iterator it3;
item->setText(3, TQString("%1").arg(info.stationName)); for (it3 = info.allowedStationIDs.begin(); it3 != info.allowedStationIDs.end(); ++it3) {
item->setText(4, info.loginStamp.toString()); StationList::iterator stationInfoIterator = m_availableWorkspaceStationsList.findByID(*it3);
item->setText(5, (info.terminateStamp.toTime_t()==0)?i18n("Not Set"):info.terminateStamp.toString()); if (stationInfoIterator != m_availableWorkspaceStationsList.end()) {
if (allowedStationsText != "") {
allowedStationsText.append(", ");
}
allowedStationsText.append((*stationInfoIterator).name);
}
}
item->setText(1, allowedStationsText);
} }
it2 = TQListViewItemIterator(m_base->workspace_list); it2 = TQListViewItemIterator(m_base->workspace_list);
while (it2.current()) { while (it2.current()) {
TQListViewItem* item = *it2; TQListViewItem* item = *it2;
bool found = false; bool found = false;
for (it = list.begin(); it != list.end(); ++it) { for (it = m_workspaceAuthGroupList.begin(); it != m_workspaceAuthGroupList.end(); ++it) {
WorkspaceServiceStatusType info = *it; WorkspaceServiceAuthGroupType info = *it;
if (info.serviceID != 0) { if (info.groupName == item->text(0)) {
continue;
}
if (info.sessionID == item->text(0).toInt()) {
found = true; found = true;
} }
} }
@ -531,7 +736,7 @@ void UserManagementPart::mainEventLoop() {
setTickerMessage(i18n("Connected")); setTickerMessage(i18n("Connected"));
} }
if (m_commHandlerState == ModeIdle_StateProcessWorkspaceList) { if (m_commHandlerState == ModeIdle_StateProcessWorkspaceServiceAuthGroupList) {
m_pingDelayTimer->start(250, TRUE); m_pingDelayTimer->start(250, TRUE);
SET_NEXT_STATE(ModeIdle_StateDelay); SET_NEXT_STATE(ModeIdle_StateDelay);
} }
@ -562,37 +767,73 @@ void UserManagementPart::mainEventLoop() {
break; break;
} }
} }
else if (m_commHandlerMode == ModeTerminate) { else if (m_commHandlerMode == ModeUpdate) {
switch (m_commHandlerState) { switch (m_commHandlerState) {
case ModeTerminate_TerminalServices: case ModeUpdate_TerminalServices:
ds << TQString("SESSION"); ds << TQString("SETGROUPACCESS");
ds << TQString("KILL_TERMINAL"); ds << TQString("TERMINALS");
ds << terminateSessionID; ds << m_updateTerminalServiceAuthGroupList;
m_socket->writeEndOfFrame(); m_socket->writeEndOfFrame();
SET_NEXT_STATE(ModeTerminate_ProcessResponse) SET_NEXT_STATE(ModeUpdate_ProcessResponse)
EXEC_NEXT_STATE_IMMEDIATELY
break;
case ModeUpdate_LaboratoryWorkspace:
ds << TQString("SETGROUPACCESS");
ds << TQString("WORKSPACES");
ds << m_updateWorkspaceServiceAuthGroupList;
m_socket->writeEndOfFrame();
SET_NEXT_STATE(ModeUpdate_ProcessResponse)
EXEC_NEXT_STATE_IMMEDIATELY
break;
case ModeUpdate_ProcessResponse:
// Get all data
if (m_socket->canReadFrame()) {
PAT_WATCHDOG_TIMER
TQString status;
WorkspaceServiceStatusList list;
ds >> status;
if (status != "OK") {
// Command failed!
KMessageBox::error(0, i18n("Command Failure"), i18n("Unable to execute command!"));
}
m_commHandlerMode = ModeIdle;
SET_NEXT_STATE(ModeIdle_StateTerminalListRequest);
EXEC_NEXT_STATE_IMMEDIATELY EXEC_NEXT_STATE_IMMEDIATELY
}
else {
if (!m_updateTimeoutTimer->isActive()) {
UPDATEDISPLAY_TIMEOUT
}
}
break; break;
case ModeTerminate_LaboratoryWorkspace: }
ds << TQString("SESSION"); }
ds << TQString("KILL_WORKSPACE"); else if (m_commHandlerMode == ModeDelete) {
ds << terminateSessionID; switch (m_commHandlerState) {
ds << terminateSessionDelayMinutes; case ModeDelete_TerminalServices:
ds << TQString("DELETEGROUPACCESS");
ds << TQString("TERMINALS");
ds << m_updateTerminalServiceAuthGroupList;
m_socket->writeEndOfFrame(); m_socket->writeEndOfFrame();
SET_NEXT_STATE(ModeTerminate_ProcessResponse) SET_NEXT_STATE(ModeDelete_ProcessResponse)
EXEC_NEXT_STATE_IMMEDIATELY EXEC_NEXT_STATE_IMMEDIATELY
break; break;
case ModeTerminate_CancelTerminationOfWorkspace: case ModeDelete_LaboratoryWorkspace:
ds << TQString("SESSION"); ds << TQString("DELETEGROUPACCESS");
ds << TQString("CANCEL_KILL_WORKSPACE"); ds << TQString("WORKSPACES");
ds << terminateSessionID; ds << m_updateWorkspaceServiceAuthGroupList;
m_socket->writeEndOfFrame(); m_socket->writeEndOfFrame();
SET_NEXT_STATE(ModeTerminate_ProcessResponse) SET_NEXT_STATE(ModeDelete_ProcessResponse)
EXEC_NEXT_STATE_IMMEDIATELY EXEC_NEXT_STATE_IMMEDIATELY
break; break;
case ModeTerminate_ProcessResponse: case ModeDelete_ProcessResponse:
// Get all data // Get all data
if (m_socket->canReadFrame()) { if (m_socket->canReadFrame()) {
PAT_WATCHDOG_TIMER PAT_WATCHDOG_TIMER

@ -20,8 +20,8 @@
* http://www.raptorengineeringinc.com * http://www.raptorengineeringinc.com
*/ */
#ifndef REMOTELAB_ADMINCONSOLEPART_H #ifndef REMOTELAB_USERMGMTPART_H
#define REMOTELAB_ADMINCONSOLEPART_H #define REMOTELAB_USERMGMTPART_H
#include <tdekrbclientsocket.h> #include <tdekrbclientsocket.h>
@ -74,9 +74,12 @@ namespace RemoteLab
void connectionStatusChangedCallback(); void connectionStatusChangedCallback();
void setTickerMessage(TQString message); void setTickerMessage(TQString message);
void terminalServiceKillButtonClicked(); void terminalServiceAddGroupButtonClicked();
void workspaceTerminateButtonClicked(); void terminalServiceModifyGroupButtonClicked();
void workspaceCancelTerminationButtonClicked(); void terminalServiceDeleteGroupButtonClicked();
void workspaceAddGroupButtonClicked();
void workspaceModifyGroupButtonClicked();
void workspaceDeleteGroupButtonClicked();
void terminalServiceListSelect(); void terminalServiceListSelect();
void workspaceListSelect(); void workspaceListSelect();
@ -92,13 +95,18 @@ namespace RemoteLab
int m_commHandlerMode; int m_commHandlerMode;
int m_commHandlerNextState; int m_commHandlerNextState;
int m_commHandlerNextMode; int m_commHandlerNextMode;
TQString terminateSessionID; TerminalServiceAuthGroupList m_updateTerminalServiceAuthGroupList;
TQ_INT32 terminateSessionDelayMinutes; WorkspaceServiceAuthGroupList m_updateWorkspaceServiceAuthGroupList;
bool m_connectionActiveAndValid; bool m_connectionActiveAndValid;
unsigned char m_tickerState; unsigned char m_tickerState;
TQByteArray m_programmingFileData; TQByteArray m_programmingFileData;
TQ_ULONG m_programmingFileTotalSize; TQ_ULONG m_programmingFileTotalSize;
TQ_ULONG m_programmingFileTransferredBytes; TQ_ULONG m_programmingFileTransferredBytes;
TQStringList m_availableTerminalServersList;
StationList m_availableWorkspaceStationsList;
TerminalServiceAuthGroupList m_terminalServiceAuthGroupList;
WorkspaceServiceAuthGroupList m_workspaceAuthGroupList;
}; };
} }

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2012 by Timothy Pearson * * Copyright (C) 2013 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net * * kb9vqf@pearsoncomputing.net *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -28,6 +28,7 @@
#include <tqpixmap.h> #include <tqpixmap.h>
#include <tqiconset.h> #include <tqiconset.h>
#include <tqlabel.h> #include <tqlabel.h>
#include <tqgroupbox.h>
#include <kconfig.h> #include <kconfig.h>
#include <tqcheckbox.h> #include <tqcheckbox.h>
#include <tqradiobutton.h> #include <tqradiobutton.h>
@ -35,60 +36,100 @@
#include "terminatedlgbase.h" #include "terminatedlgbase.h"
#include "terminatedlg.h" #include "terminatedlg.h"
TerminateDialog::TerminateDialog(TQWidget* parent, const char* name) TQListBoxKeyedText::TQListBoxKeyedText(TQListBox* listbox, const TQString & text, const TQ_UINT32 key) : TQListBoxText(listbox, text), m_key(key) {
: KDialogBase(parent, name, true, i18n("Terminate Session"), Ok|Cancel, Ok, true) //
}
TQListBoxKeyedText::TQListBoxKeyedText(const TQString & text, const TQ_UINT32 key) : TQListBoxText(text), m_key(key) {
//
}
TQListBoxKeyedText::TQListBoxKeyedText(TQListBox* listbox, const TQString & text, const TQ_UINT32 key, TQListBoxItem *after) : TQListBoxText(listbox, text, after), m_key(key) {
//
}
TQListBoxKeyedText::~TQListBoxKeyedText() {
//
}
TQ_UINT32 TQListBoxKeyedText::key() {
return m_key;
}
GroupPermissionsDialog::GroupPermissionsDialog(TQWidget* parent, const char* name)
: KDialogBase(parent, name, true, i18n("Manage Permissions"), Ok|Cancel, Ok, true)
{ {
m_base = new TerminateDlgBase(this); m_base = new GroupPermissionsDlgBase(this);
m_base->permissionsSelector->availableListBox()->setSelectionMode(TQListBox::Multi);
m_base->permissionsSelector->selectedListBox()->setSelectionMode(TQListBox::Multi);
setMainWidget(m_base); setMainWidget(m_base);
connect(m_base->m_btnImmediate, SIGNAL(clicked()), this, SLOT(processLockouts())); connect(m_base->m_groupName, SIGNAL(textChanged(const TQString&)), this, SLOT(processLockouts()));
connect(m_base->m_btnDelayed, SIGNAL(clicked()), this, SLOT(processLockouts())); m_base->m_groupName->setFocus();
m_base->m_btnDelayed->setChecked(false);
m_base->m_btnImmediate->setChecked(true);
processLockouts(); processLockouts();
} }
void TerminateDialog::processLockouts() { void GroupPermissionsDialog::processLockouts() {
if (m_base->m_btnDelayed->isChecked()) { if (m_base->m_groupName->text() != "") {
m_base->terminateMinutes->setEnabled(true); enableButtonOK(true);
} }
if (m_base->m_btnImmediate->isChecked()) { else {
m_base->terminateMinutes->setEnabled(false); enableButtonOK(false);
} }
} }
void TerminateDialog::setWarningLabelText(TQString text) { void GroupPermissionsDialog::setGroupName(TQString name, bool editable) {
m_base->m_warningLabel->setText(text); m_base->m_groupName->setText(name);
m_base->m_groupName->setEnabled(editable);
} }
void TerminateDialog::enableDelayedTermination(bool enabled) { TQString GroupPermissionsDialog::groupName() {
if (enabled) { return m_base->m_groupName->text();
m_base->m_btnImmediate->setEnabled(true); }
m_base->m_btnDelayed->setEnabled(true);
} void GroupPermissionsDialog::setPermissionsSelectorLabel(TQString label) {
else { m_base->groupPermissionsSelector->setTitle(label);
m_base->m_btnImmediate->setChecked(true); }
m_base->m_btnImmediate->setEnabled(true);
m_base->m_btnDelayed->setEnabled(false); void GroupPermissionsDialog::setAvailableServers(TQKeyedStringList list) {
TQListBox* availableListBox = m_base->permissionsSelector->availableListBox();
for (TQKeyedStringList::Iterator it = list.begin(); it != list.end(); ++it) {
new TQListBoxKeyedText(availableListBox, (*it).first, (*it).second);
} }
availableListBox->sort(true);
} }
bool TerminateDialog::delayed() { void GroupPermissionsDialog::setSelectedServers(TQKeyedStringList list) {
return m_base->m_btnDelayed->isChecked(); TQListBox* availableListBox = m_base->permissionsSelector->availableListBox();
TQListBox* selectedListBox = m_base->permissionsSelector->selectedListBox();
for (TQKeyedStringList::Iterator it = list.begin(); it != list.end(); ++it) {
TQListBoxItem* item = availableListBox->findItem((*it).first, ExactMatch);
if (item) {
delete item;
}
new TQListBoxKeyedText(selectedListBox, (*it).first, (*it).second);
}
availableListBox->sort(true);
selectedListBox->sort(true);
} }
int TerminateDialog::minutes() { TQKeyedStringList GroupPermissionsDialog::selectedServers() {
if (m_base->m_btnDelayed->isChecked()) { TQKeyedStringList list;
return m_base->terminateMinutes->value(); TQListBox* selectedListBox = m_base->permissionsSelector->selectedListBox();
TQListBoxItem* item = selectedListBox->firstItem();
while (item) {
TQListBoxKeyedText* item2 = dynamic_cast<TQListBoxKeyedText*>(item);
if (item2) {
list.append(TQKeyedStringPair(item2->text(), item2->key()));
} }
else { item = item->next();
return -1;
} }
return list;
} }
void TerminateDialog::slotOk() { void GroupPermissionsDialog::slotOk() {
accept(); accept();
} }

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2012 by Timothy Pearson * * Copyright (C) 2013 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net * * kb9vqf@pearsoncomputing.net *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -24,30 +24,50 @@
#include <kdialogbase.h> #include <kdialogbase.h>
#include <kcombobox.h> #include <kcombobox.h>
class TerminateDlgBase; class GroupPermissionsDlgBase;
class TopLevel; class TopLevel;
class TerminateDialog : public KDialogBase typedef TQPair< TQString, TQ_UINT32 > TQKeyedStringPair;
typedef TQValueList< TQKeyedStringPair > TQKeyedStringList;
class TQListBoxKeyedText : public TQListBoxText
{
public:
TQListBoxKeyedText(TQListBox* listbox, const TQString & text=TQString::null, const TQ_UINT32 key=0);
TQListBoxKeyedText(const TQString & text=TQString::null, const TQ_UINT32 key=0 );
TQListBoxKeyedText(TQListBox* listbox, const TQString & text, const TQ_UINT32 key, TQListBoxItem *after);
~TQListBoxKeyedText();
public:
TQ_UINT32 key();
private:
TQ_UINT32 m_key;
};
class GroupPermissionsDialog : public KDialogBase
{ {
Q_OBJECT Q_OBJECT
public: public:
TerminateDialog(TQWidget* parent = 0, const char* name = 0); GroupPermissionsDialog(TQWidget* parent = 0, const char* name = 0);
public slots: public:
void slotOk(); void setGroupName(TQString name, bool editable);
TQString groupName();
void setPermissionsSelectorLabel(TQString label);
void setAvailableServers(TQKeyedStringList list);
void setSelectedServers(TQKeyedStringList list);
TQKeyedStringList selectedServers();
public: public slots:
void enableDelayedTermination(bool enabled); void slotOk();
void setWarningLabelText(TQString text);
bool delayed();
int minutes();
private slots: private slots:
void processLockouts(); void processLockouts();
private: private:
TerminateDlgBase *m_base; GroupPermissionsDlgBase *m_base;
}; };
#endif #endif

@ -1,8 +1,8 @@
<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> <!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>TerminateDlgBase</class> <class>GroupPermissionsDlgBase</class>
<widget class="TQWidget"> <widget class="TQWidget">
<property name="name"> <property name="name">
<cstring>TerminateDlgBase</cstring> <cstring>GroupPermissionsDlgBase</cstring>
</property> </property>
<grid> <grid>
<widget class="TQButtonGroup"> <widget class="TQButtonGroup">
@ -25,52 +25,33 @@
<property name="margin"> <property name="margin">
<number>0</number> <number>0</number>
</property> </property>
<widget class="TQLabel" row="0" column="0" colspan="2"> <widget class="TQLabel" row="0" column="0" colspan="0">
<property name="name"> <property name="name">
<cstring>m_warningLabel</cstring> <cstring>m_groupNameLabel</cstring>
</property> </property>
<property name="text"> <property name="text">
<string></string> <string>Group Name:</string>
</property> </property>
</widget> </widget>
<widget class="TQRadioButton" row="1" column="0"> <widget class="KLineEdit" row="0" column="1" colspan="0">
<property name="name"> <property name="name">
<cstring>m_btnImmediate</cstring> <cstring>m_groupName</cstring>
</property>
<property name="focusPolicy">
<enum>NoFocus</enum>
</property> </property>
<property name="text"> <property name="text">
<string>Terminate Now</string> <string></string>
</property> </property>
</widget> </widget>
<widget class="TQRadioButton" row="2" column="0"> <widget class="TQGroupBox" row="1" column="0" colspan="2">
<property name="name"> <property name="name">
<cstring>m_btnDelayed</cstring> <cstring>groupPermissionsSelector</cstring>
</property>
<property name="focusPolicy">
<enum>NoFocus</enum>
</property> </property>
<property name="text">
<string>Terminate After</string>
</property>
</widget>
<widget class="TQLayoutWidget" row="2" column="1">
<grid> <grid>
<property name="name"> <property name="name">
<cstring>unnamed</cstring> <cstring>unnamed</cstring>
</property> </property>
<widget class="KIntNumInput" row="0" column="1"> <widget class="KActionSelector" row="0" column="0">
<property name="name"> <property name="name">
<cstring>terminateMinutes</cstring> <cstring>permissionsSelector</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="2">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<string>minutes</string>
</property> </property>
</widget> </widget>
</grid> </grid>

@ -4,6 +4,7 @@ MySQL - 5.5.22-0ubuntu1 : Database - remotelab
********************************************************************* *********************************************************************
*/ */
/*!40101 SET NAMES utf8 */; /*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/; /*!40101 SET SQL_MODE=''*/;
@ -39,8 +40,8 @@ DROP TABLE IF EXISTS `permissions`;
CREATE TABLE `permissions` ( CREATE TABLE `permissions` (
`pk` bigint(20) NOT NULL AUTO_INCREMENT, `pk` bigint(20) NOT NULL AUTO_INCREMENT,
`station` bigint(20) NOT NULL, `station` bigint(20) NOT NULL,
`username` text NOT NULL, `groupname` text NOT NULL,
`userrealm` text, `realm` text,
`restrictions` text, `restrictions` text,
PRIMARY KEY (`pk`) PRIMARY KEY (`pk`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1; ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2012 by Timothy Pearson * * Copyright (C) 2012-2013 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net * * kb9vqf@pearsoncomputing.net *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -463,6 +463,29 @@ TQDataStream &operator>>( TQDataStream &s, StationType &st )
return s; return s;
} }
StationList::StationList() : TQValueList<StationType>() {
//
}
StationList::~StationList() {
//
}
/*!
\relates StationType
Finds a StationType with ID \a id in this list.
*/
StationList::iterator StationList::findByID(TQ_UINT32 id) {
StationList::iterator it;
for (it = begin(); it != end(); ++it) {
if ((*it).id == id) {
break;
}
}
return it;
}
/*! /*!
\relates SensorType \relates SensorType
@ -508,7 +531,7 @@ TQDataStream &operator>>( TQDataStream &s, SensorType &st )
/*! /*!
\relates TerminalServiceStatusType \relates TerminalServiceStatusType
Writes the TerminalServiceStatusType \a str to the stream \a s. Writes the TerminalServiceStatusType \a st to the stream \a s.
See also \link datastreamformat.html Format of the TQDataStream operators \endlink See also \link datastreamformat.html Format of the TQDataStream operators \endlink
*/ */
@ -531,7 +554,7 @@ TQDataStream &operator<<( TQDataStream &s, const TerminalServiceStatusType &st )
/*! /*!
\relates SensorType \relates SensorType
Reads a SensorType from the stream \a s into SensorType \a str. Reads a TerminalServiceStatusType from the stream \a s into TerminalServiceStatusType \a st.
See also \link datastreamformat.html Format of the TQDataStream operators \endlink See also \link datastreamformat.html Format of the TQDataStream operators \endlink
*/ */
@ -554,7 +577,7 @@ TQDataStream &operator>>( TQDataStream &s, TerminalServiceStatusType &st )
/*! /*!
\relates WorkspaceServiceStatusType \relates WorkspaceServiceStatusType
Writes the WorkspaceServiceStatusType \a str to the stream \a s. Writes the WorkspaceServiceStatusType \a st to the stream \a s.
See also \link datastreamformat.html Format of the TQDataStream operators \endlink See also \link datastreamformat.html Format of the TQDataStream operators \endlink
*/ */
@ -575,9 +598,9 @@ TQDataStream &operator<<( TQDataStream &s, const WorkspaceServiceStatusType &st
} }
/*! /*!
\relates SensorType \relates WorkspaceServiceStatusType
Reads a SensorType from the stream \a s into SensorType \a str. Reads a WorkspaceServiceStatusType from the stream \a s into WorkspaceServiceStatusType \a st.
See also \link datastreamformat.html Format of the TQDataStream operators \endlink See also \link datastreamformat.html Format of the TQDataStream operators \endlink
*/ */
@ -596,5 +619,114 @@ TQDataStream &operator>>( TQDataStream &s, WorkspaceServiceStatusType &st )
s >> st.terminateStamp; s >> st.terminateStamp;
return s; return s;
} }
/*!
\relates TerminalServiceAuthGroupType
Writes the TerminalServiceAuthGroupType \a agt to the stream \a s.
See also \link datastreamformat.html Format of the TQDataStream operators \endlink
*/
TQDataStream &operator<<( TQDataStream &s, const TerminalServiceAuthGroupType &agt )
{
s << agt.protocolVersion;
s << agt.groupName;
s << agt.allowedServerNames;
return s;
}
/*!
\relates TerminalServiceAuthGroupType
Reads a TerminalServiceAuthGroupType from the stream \a s into TerminalServiceAuthGroupType \a agt.
See also \link datastreamformat.html Format of the TQDataStream operators \endlink
*/
TQDataStream &operator>>( TQDataStream &s, TerminalServiceAuthGroupType &agt )
{
s >> agt.protocolVersion;
s >> agt.groupName;
s >> agt.allowedServerNames;
return s;
}
/*!
\relates WorkspaceServiceAuthGroupType
Writes the WorkspaceServiceAuthGroupType \a agt to the stream \a s.
See also \link datastreamformat.html Format of the TQDataStream operators \endlink
*/
TQDataStream &operator<<( TQDataStream &s, const WorkspaceServiceAuthGroupType &agt )
{
s << agt.protocolVersion;
s << agt.groupName;
s << agt.allowedStationIDs;
return s;
}
/*!
\relates WorkspaceServiceAuthGroupType
Reads a WorkspaceServiceAuthGroupType from the stream \a s into WorkspaceServiceAuthGroupType \a agt.
See also \link datastreamformat.html Format of the TQDataStream operators \endlink
*/
TQDataStream &operator>>( TQDataStream &s, WorkspaceServiceAuthGroupType &agt )
{
s >> agt.protocolVersion;
s >> agt.groupName;
s >> agt.allowedStationIDs;
return s;
}
#endif // QT_NO_DATASTREAM #endif // QT_NO_DATASTREAM
TerminalServiceAuthGroupList::TerminalServiceAuthGroupList() : TQValueList<TerminalServiceAuthGroupType>() {
//
}
TerminalServiceAuthGroupList::~TerminalServiceAuthGroupList() {
//
}
/*!
\relates WorkspaceServiceAuthGroupType
Finds a WorkspaceServiceAuthGroupType with group name \a name in this list.
*/
TerminalServiceAuthGroupList::iterator TerminalServiceAuthGroupList::findByName(TQString name) {
TerminalServiceAuthGroupList::iterator it;
for (it = begin(); it != end(); ++it) {
if ((*it).groupName == name) {
break;
}
}
return it;
}
WorkspaceServiceAuthGroupList::WorkspaceServiceAuthGroupList() : TQValueList<WorkspaceServiceAuthGroupType>() {
//
}
WorkspaceServiceAuthGroupList::~WorkspaceServiceAuthGroupList() {
//
}
/*!
\relates WorkspaceServiceAuthGroupType
Finds a WorkspaceServiceAuthGroupType with group name \a name in this list.
*/
WorkspaceServiceAuthGroupList::iterator WorkspaceServiceAuthGroupList::findByName(TQString name) {
WorkspaceServiceAuthGroupList::iterator it;
for (it = begin(); it != end(); ++it) {
if ((*it).groupName == name) {
break;
}
}
return it;
}

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2012 by Timothy Pearson * * Copyright (C) 2012-2013 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net * * kb9vqf@pearsoncomputing.net *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -165,7 +165,15 @@ Q_EXPORT TQDataStream &operator<<(TQDataStream &, const StationType &);
Q_EXPORT TQDataStream &operator>>(TQDataStream &, StationType &); Q_EXPORT TQDataStream &operator>>(TQDataStream &, StationType &);
#endif #endif
typedef TQValueList<StationType> StationList; class StationList : public TQValueList<StationType>
{
public:
StationList();
virtual ~StationList();
public:
StationList::iterator findByID(TQ_UINT32 id);
};
// ============================================================================= // =============================================================================
@ -239,4 +247,54 @@ typedef TQValueList<WorkspaceServiceStatusType> WorkspaceServiceStatusList;
// ============================================================================= // =============================================================================
class TerminalServiceAuthGroupType
{
public:
TQ_UINT32 protocolVersion;
TQString groupName;
TQStringList allowedServerNames;
};
#ifndef QT_NO_DATASTREAM
Q_EXPORT TQDataStream &operator<<(TQDataStream &, const TerminalServiceAuthGroupType &);
Q_EXPORT TQDataStream &operator>>(TQDataStream &, TerminalServiceAuthGroupType &);
#endif
class TerminalServiceAuthGroupList : public TQValueList<TerminalServiceAuthGroupType>
{
public:
TerminalServiceAuthGroupList();
virtual ~TerminalServiceAuthGroupList();
public:
TerminalServiceAuthGroupList::iterator findByName(TQString name);
};
// =============================================================================
class WorkspaceServiceAuthGroupType
{
public:
TQ_UINT32 protocolVersion;
TQString groupName;
TQInt32List allowedStationIDs;
};
#ifndef QT_NO_DATASTREAM
Q_EXPORT TQDataStream &operator<<(TQDataStream &, const WorkspaceServiceAuthGroupType &);
Q_EXPORT TQDataStream &operator>>(TQDataStream &, WorkspaceServiceAuthGroupType &);
#endif
class WorkspaceServiceAuthGroupList : public TQValueList<WorkspaceServiceAuthGroupType>
{
public:
WorkspaceServiceAuthGroupList();
virtual ~WorkspaceServiceAuthGroupList();
public:
WorkspaceServiceAuthGroupList::iterator findByName(TQString name);
};
// =============================================================================
#endif // TQTRLA_H #endif // TQTRLA_H

@ -1,4 +1,4 @@
# generated automatically by aclocal 1.11.3 -*- Autoconf -*- # generated automatically by aclocal 1.11.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
@ -14,8 +14,8 @@
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
[m4_warning([this file was generated for autoconf 2.68. [m4_warning([this file was generated for autoconf 2.69.
You have another version of autoconf. It may work, but is not guaranteed to. You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely. If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])]) To do so, use the procedure documented by the package, typically `autoreconf'.])])
@ -664,7 +664,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.11' [am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro. dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.11.3], [], m4_if([$1], [1.11.6], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
]) ])
@ -680,7 +680,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.11.3])dnl [AM_AUTOMAKE_VERSION([1.11.6])dnl
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am. # Makefile.in generated by automake 1.11.6 from Makefile.am.
# KDE tags expanded automatically by am_edit - $Revision$ # KDE tags expanded automatically by am_edit - $Revision$
# @configure_input@ # @configure_input@
@ -19,6 +19,23 @@
# the SUBDIRS is filled automatically by am_edit. If files are # the SUBDIRS is filled automatically by am_edit. If files are
# in this directory they are installed into the english dir # in this directory they are installed into the english dir
VPATH = @srcdir@ VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@ pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@
@ -66,6 +83,11 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
install-pdf-recursive install-ps-recursive install-recursive \ install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive nmcheck-recursive bcheck-recursive ps-recursive uninstall-recursive nmcheck-recursive bcheck-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@ -592,13 +614,10 @@ distdir: $(DISTFILES)
done done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \ if test "$$subdir" = .; then :; else \
test -d "$(distdir)/$$subdir" \ $(am__make_dryrun) \
|| test -d "$(distdir)/$$subdir" \
|| $(MKDIR_P) "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \
|| exit 1; \ || exit 1; \
fi; \
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \ $(am__relativize); \
new_distdir=$$reldir; \ new_distdir=$$reldir; \

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am. # Makefile.in generated by automake 1.11.6 from Makefile.am.
# KDE tags expanded automatically by am_edit - $Revision$ # KDE tags expanded automatically by am_edit - $Revision$
# @configure_input@ # @configure_input@
@ -16,6 +16,23 @@
@SET_MAKE@ @SET_MAKE@
VPATH = @srcdir@ VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@ pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@
@ -48,6 +65,11 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
SOURCES = SOURCES =
DIST_SOURCES = DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
#>+ 1 #>+ 1
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST)

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am. # Makefile.in generated by automake 1.11.6 from Makefile.am.
# KDE tags expanded automatically by am_edit - $Revision$ # KDE tags expanded automatically by am_edit - $Revision$
# @configure_input@ # @configure_input@
@ -16,6 +16,23 @@
@SET_MAKE@ @SET_MAKE@
VPATH = @srcdir@ VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
case $$MAKEFLAGS in \
*\\[\ \ ]*) \
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
*) \
for am__flg in $$MAKEFLAGS; do \
case $$am__flg in \
*=*|--*) ;; \
*n*) am__dry=yes; break;; \
esac; \
done;; \
esac; \
test $$am__dry = yes; \
}
pkgdatadir = $(datadir)/@PACKAGE@ pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@
@ -48,6 +65,11 @@ CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES = CONFIG_CLEAN_VPATH_FILES =
SOURCES = SOURCES =
DIST_SOURCES = DIST_SOURCES =
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
#>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) #>- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
#>+ 1 #>+ 1
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) $(KDE_DIST)

@ -3,7 +3,7 @@ KDE_CXXFLAGS = $(USE_EXCEPTIONS)
bin_PROGRAMS = remotefpga_adminsysctlserver bin_PROGRAMS = remotefpga_adminsysctlserver
remotefpga_adminsysctlserver_SOURCES = main.cpp admin_sys_ctl.cpp remotefpga_adminsysctlserver_SOURCES = main.cpp admin_user_mgmt.cpp
remotefpga_adminsysctlserver_METASOURCES = AUTO remotefpga_adminsysctlserver_METASOURCES = AUTO
remotefpga_adminsysctlserver_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -ltdekrbsocket -ltqtrla remotefpga_adminsysctlserver_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_KIO) -lktexteditor -ltdekrbsocket -ltqtrla

@ -40,7 +40,7 @@
#include <klocale.h> #include <klocale.h>
#include "admin_sys_ctl.h" #include "admin_user_mgmt.h"
#define ABORT_SOCKET(s) s->close(); \ #define ABORT_SOCKET(s) s->close(); \
s->disconnect(); \ s->disconnect(); \
@ -83,6 +83,9 @@ SysCtlSocket::SysCtlSocket(int sock, TQObject *parent, const char *name) :
if (connectToDatabase() != 0) { if (connectToDatabase() != 0) {
exit(1); exit(1);
} }
m_minGID = m_config->readNumEntry("MinimumGID", 500);
m_maxGID = m_config->readNumEntry("MaximumGID", 65533);
} }
SysCtlSocket::~SysCtlSocket() { SysCtlSocket::~SysCtlSocket() {
@ -176,30 +179,17 @@ void SysCtlSocket::commandLoop() {
ds.setPrintableData(true); ds.setPrintableData(true);
TQString command; TQString command;
ds >> command; ds >> command;
if (command == "USERS") { if (command == "LIST") {
TQString subCommand; TQString subCommand;
ds >> subCommand; ds >> subCommand;
if (subCommand == "TERMINALS") { if (subCommand == "TERMINALS") {
clearFrameTail(); clearFrameTail();
ds << TQString("OK"); ds << TQString("OK");
TerminalServiceStatusList list; TQStringList list;
TQSqlCursor databaseActivityCursor("sessions", TRUE, m_terminals_database); TQSqlCursor databaseServersCursor("servers", TRUE, m_terminals_database);
databaseActivityCursor.select(); databaseServersCursor.select();
while (databaseActivityCursor.next()) { while (databaseServersCursor.next()) {
TerminalServiceStatusType status; list.append(databaseServersCursor.value("name").toString());
status.protocolVersion = 1;
status.sessionID = databaseActivityCursor.value("pk").toInt();
status.username = databaseActivityCursor.value("username").toString();
status.serverName = databaseActivityCursor.value("servername").toString();
status.serverPID = databaseActivityCursor.value("server_pid").toInt();
status.wmPID = databaseActivityCursor.value("wm_pid").toInt();
status.state = databaseActivityCursor.value("state").toInt();
status.display = databaseActivityCursor.value("display").toInt();
status.loginStamp.setTime_t(databaseActivityCursor.value("stamp_start").toLongLong());
status.activityStamp.setTime_t(databaseActivityCursor.value("stamp_statechange").toLongLong());
list.append(status);
} }
ds << list; ds << list;
writeEndOfFrame(); writeEndOfFrame();
@ -207,29 +197,41 @@ void SysCtlSocket::commandLoop() {
else if (subCommand == "WORKSPACES") { else if (subCommand == "WORKSPACES") {
clearFrameTail(); clearFrameTail();
ds << TQString("OK"); ds << TQString("OK");
WorkspaceServiceStatusList list;
TQSqlCursor databaseActivityCursor("activity", TRUE, m_workspaces_database);
databaseActivityCursor.select();
while (databaseActivityCursor.next()) {
WorkspaceServiceStatusType status;
status.protocolVersion = 1;
status.sessionID = databaseActivityCursor.value("pk").toInt();
status.stationID = databaseActivityCursor.value("station").toInt();
status.username = databaseActivityCursor.value("username").toString();
status.realmname = databaseActivityCursor.value("realmname").toString();
status.serverID = databaseActivityCursor.value("serverid").toInt();
status.serviceID = databaseActivityCursor.value("serviceid").toInt();
status.stationID = databaseActivityCursor.value("station").toInt();
TQSqlCursor databaseStationsCursor("stations", TRUE, m_workspaces_database);
databaseStationsCursor.select(TQString("pk=%1").arg(status.stationID));
if (databaseStationsCursor.next()) {
status.stationName = databaseStationsCursor.value("name").toString();
}
status.loginStamp.setTime_t(databaseActivityCursor.value("logontime").toLongLong());
status.terminateStamp.setTime_t(databaseActivityCursor.value("terminate").toLongLong());
list.append(status); StationList list;
TQSqlCursor databaseStationsCursor("stations", TRUE, m_workspaces_database);
TQSqlCursor databaseServicesCursor("services", TRUE, m_workspaces_database);
TQSqlCursor databaseServiceTypesCursor("servicetypes", TRUE, m_workspaces_database);
databaseStationsCursor.select();
while (databaseStationsCursor.next()) {
StationType st;
st.id = databaseStationsCursor.value("pk").toInt();
st.name = databaseStationsCursor.value("name").toString();
st.description = databaseStationsCursor.value("description").toString();
databaseServicesCursor.select(TQString("station=%1").arg(databaseStationsCursor.value("pk").toInt()));
while (databaseServicesCursor.next()) {
databaseServiceTypesCursor.select(TQString("serviceid=%1").arg(databaseServicesCursor.value("servicetype").toInt()));
ServiceType svt;
if (databaseServiceTypesCursor.next()) {
svt.type = databaseServiceTypesCursor.value("serviceid").toInt();
svt.name = databaseServiceTypesCursor.value("name").toString();
svt.description = databaseServiceTypesCursor.value("description").toString();
svt.clientLibrary = databaseServiceTypesCursor.value("client_library").toString();
svt.version = databaseServiceTypesCursor.value("version").toInt();
char tempchar;
tempchar = databaseServiceTypesCursor.value("single_instance").toInt();
svt.singleInstance = (tempchar != 0);
}
if (svt.name == "") {
svt.name = i18n("<unknown>");
}
if (svt.description == "") {
svt.description = i18n("<unknown>");
}
st.services.append(svt);
}
list.append(st);
} }
ds << list; ds << list;
writeEndOfFrame(); writeEndOfFrame();
@ -240,42 +242,134 @@ void SysCtlSocket::commandLoop() {
writeEndOfFrame(); writeEndOfFrame();
} }
} }
else if (command == "SESSION") { else if (command == "LISTGROUPACCESS") {
TQString subCommand; TQString subCommand;
TQString sessionID;
ds >> subCommand; ds >> subCommand;
ds >> sessionID; if (subCommand == "TERMINALS") {
if (subCommand == "LOGOFF_TERMINAL") {
TQ_UINT32 delay;
ds >> delay;
clearFrameTail(); clearFrameTail();
// FIXME UNIMPLEMENTED ds << TQString("OK");
ds << TQString("ERRINVCMD"); TerminalServiceAuthGroupList list;
// First search the database for groups...
TQSqlCursor databasePermissionsCursor("allowed_servers", TRUE, m_terminals_database);
databasePermissionsCursor.select();
while (databasePermissionsCursor.next()) {
TerminalServiceAuthGroupType agt;
TerminalServiceAuthGroupList::iterator it = list.findByName(databasePermissionsCursor.value("groupname").toString());
if (it != list.end()) {
agt = *it;
list.remove(it);
}
else {
agt.protocolVersion = 1;
agt.groupName = databasePermissionsCursor.value("groupname").toString();
}
agt.allowedServerNames.append(databasePermissionsCursor.value("server").toString());
list.append(agt);
}
// ...then search LDAP for groups that were not already in the database
struct group* group;
setgrent();
while ((group = getgrent())) {
if ((group->gr_gid >= m_minGID) && (group->gr_gid <= m_maxGID)) {
TerminalServiceAuthGroupType agt;
TerminalServiceAuthGroupList::iterator it = list.findByName(TQString(group->gr_name));
if (it == list.end()) {
agt.protocolVersion = 1;
agt.groupName = TQString(group->gr_name);
list.append(agt);
}
}
}
endgrent();
ds << list;
writeEndOfFrame(); writeEndOfFrame();
} }
else if (subCommand == "CANCEL_LOGOFF_TERMINAL") { else if (subCommand == "WORKSPACES") {
clearFrameTail();
ds << TQString("OK");
WorkspaceServiceAuthGroupList list;
// First search the database for groups...
TQSqlCursor databasePermissionsCursor("permissions", TRUE, m_workspaces_database);
databasePermissionsCursor.select();
while (databasePermissionsCursor.next()) {
WorkspaceServiceAuthGroupType agt;
WorkspaceServiceAuthGroupList::iterator it = list.findByName(databasePermissionsCursor.value("groupname").toString());
if (it != list.end()) {
agt = *it;
list.remove(it);
}
else {
agt.protocolVersion = 1;
agt.groupName = databasePermissionsCursor.value("groupname").toString();
}
agt.allowedStationIDs.append(databasePermissionsCursor.value("station").toUInt());
list.append(agt);
}
// ...then search LDAP for groups that were not already in the database
struct group* group;
setgrent();
while ((group = getgrent())) {
if ((group->gr_gid >= m_minGID) && (group->gr_gid <= m_maxGID)) {
WorkspaceServiceAuthGroupType agt;
WorkspaceServiceAuthGroupList::iterator it = list.findByName(TQString(group->gr_name));
if (it == list.end()) {
agt.protocolVersion = 1;
agt.groupName = TQString(group->gr_name);
list.append(agt);
}
}
}
endgrent();
ds << list;
writeEndOfFrame();
}
else {
clearFrameTail(); clearFrameTail();
// FIXME UNIMPLEMENTED
ds << TQString("ERRINVCMD"); ds << TQString("ERRINVCMD");
writeEndOfFrame(); writeEndOfFrame();
} }
else if (subCommand == "KILL_TERMINAL") { }
else if (command == "SETGROUPACCESS") {
TQString subCommand;
ds >> subCommand;
if (subCommand == "TERMINALS") {
TerminalServiceAuthGroupList list;
ds >> list;
clearFrameTail(); clearFrameTail();
TQSqlCursor databaseActivityCursor("sessions", TRUE, m_terminals_database);
databaseActivityCursor.select(TQString("pk=%1").arg(sessionID)); bool success = true;
if (databaseActivityCursor.next()) { TQSqlCursor databasePermissionsCursor("allowed_servers", TRUE, m_terminals_database);
// Gather server information TerminalServiceAuthGroupList::iterator it;
TQString server_name = databaseActivityCursor.value("servername").toString(); for (it = list.begin(); it != list.end(); ++it) {
int server_pid = databaseActivityCursor.value("server_pid").toInt(); TerminalServiceAuthGroupType agt = *it;
// Kill server process
TQString command = TQString("ssh root@%1 'kill -9 %2'").arg(server_name).arg(server_pid); // Delete all existing entries for this group in perparation for update
if (system(command.ascii()) == 0) { databasePermissionsCursor.select(TQString("groupname='%1'").arg(agt.groupName));
// Remove database entry while (databasePermissionsCursor.next()) {
databaseActivityCursor.select(TQString("pk=%1").arg(sessionID)); databasePermissionsCursor.primeDelete();
if (databaseActivityCursor.next()) { databasePermissionsCursor.del(false);
databaseActivityCursor.primeDelete(); }
databaseActivityCursor.del(true);
// Insert all entries for this group from the information structure
TQStringList::iterator it2;
for (it2 = agt.allowedServerNames.begin(); it2 != agt.allowedServerNames.end(); ++it2) {
TQSqlRecord *buffer = databasePermissionsCursor.primeInsert();
buffer->setValue("groupname", agt.groupName);
buffer->setValue("server", *it2);
databasePermissionsCursor.insert();
}
} }
if (success) {
ds << TQString("OK"); ds << TQString("OK");
} }
else { else {
@ -283,49 +377,102 @@ void SysCtlSocket::commandLoop() {
} }
writeEndOfFrame(); writeEndOfFrame();
} }
else if (subCommand == "WORKSPACES") {
WorkspaceServiceAuthGroupList list;
ds >> list;
clearFrameTail();
bool success = true;
TQSqlCursor databasePermissionsCursor("permissions", TRUE, m_workspaces_database);
WorkspaceServiceAuthGroupList::iterator it;
for (it = list.begin(); it != list.end(); ++it) {
WorkspaceServiceAuthGroupType agt = *it;
// Delete all existing entries for this group in perparation for update
databasePermissionsCursor.select(TQString("groupname='%1'").arg(agt.groupName));
while (databasePermissionsCursor.next()) {
databasePermissionsCursor.primeDelete();
databasePermissionsCursor.del(false);
}
// Insert all entries for this group from the information structure
TQInt32List::iterator it2;
for (it2 = agt.allowedStationIDs.begin(); it2 != agt.allowedStationIDs.end(); ++it2) {
TQSqlRecord *buffer = databasePermissionsCursor.primeInsert();
buffer->setValue("groupname", agt.groupName);
buffer->setValue("station", *it2);
databasePermissionsCursor.insert();
}
}
if (success) {
ds << TQString("OK");
}
else { else {
ds << TQString("ERRINVCMD"); ds << TQString("ERRFAILED");
}
writeEndOfFrame();
} }
else {
clearFrameTail();
ds << TQString("ERRINVCMD");
writeEndOfFrame(); writeEndOfFrame();
} }
else if (subCommand == "KILL_WORKSPACE") { }
TQ_INT32 terminationOffset; else if (command == "DELETEGROUPACCESS") {
ds >> terminationOffset; TQString subCommand;
ds >> subCommand;
if (subCommand == "TERMINALS") {
TerminalServiceAuthGroupList list;
ds >> list;
clearFrameTail(); clearFrameTail();
TQDateTime terminationTime = TQDateTime::currentDateTime();
terminationTime = terminationTime.addSecs(terminationOffset*60); bool success = true;
TQSqlCursor databaseActivityCursor("activity", TRUE, m_workspaces_database); TQSqlCursor databasePermissionsCursor("allowed_servers", TRUE, m_terminals_database);
databaseActivityCursor.select(TQString("pk=%1").arg(sessionID)); TerminalServiceAuthGroupList::iterator it;
if (databaseActivityCursor.next()) { for (it = list.begin(); it != list.end(); ++it) {
TQSqlRecord *buffer = databaseActivityCursor.primeUpdate(); TerminalServiceAuthGroupType agt = *it;
if (terminationOffset > -2) {
buffer->setValue("terminate", terminationTime.toTime_t()); // Delete all existing entries for this group
databasePermissionsCursor.select(TQString("groupname='%1'").arg(agt.groupName));
while (databasePermissionsCursor.next()) {
databasePermissionsCursor.primeDelete();
databasePermissionsCursor.del(false);
} }
else {
buffer->setValue("terminate", 0);
} }
databaseActivityCursor.update();
if (success) {
ds << TQString("OK"); ds << TQString("OK");
} }
else { else {
ds << TQString("ERRINVCMD"); ds << TQString("ERRFAILED");
} }
writeEndOfFrame(); writeEndOfFrame();
} }
else if (subCommand == "CANCEL_KILL_WORKSPACE") { else if (subCommand == "WORKSPACES") {
WorkspaceServiceAuthGroupList list;
ds >> list;
clearFrameTail(); clearFrameTail();
TQSqlCursor databaseActivityCursor("activity", TRUE, m_workspaces_database);
databaseActivityCursor.select(TQString("pk=%1").arg(sessionID));
if (databaseActivityCursor.next()) {
TQSqlRecord *buffer = databaseActivityCursor.primeUpdate();
buffer->setValue("terminate", 0);
databaseActivityCursor.update();
bool success = true;
TQSqlCursor databasePermissionsCursor("permissions", TRUE, m_workspaces_database);
WorkspaceServiceAuthGroupList::iterator it;
for (it = list.begin(); it != list.end(); ++it) {
WorkspaceServiceAuthGroupType agt = *it;
// Delete all existing entries for this group
databasePermissionsCursor.select(TQString("groupname='%1'").arg(agt.groupName));
while (databasePermissionsCursor.next()) {
databasePermissionsCursor.primeDelete();
databasePermissionsCursor.del(false);
}
}
if (success) {
ds << TQString("OK"); ds << TQString("OK");
} }
else { else {
ds << TQString("ERRINVCMD"); ds << TQString("ERRFAILED");
} }
writeEndOfFrame(); writeEndOfFrame();
} }

@ -20,6 +20,8 @@
* http://www.raptorengineeringinc.com * http://www.raptorengineeringinc.com
*/ */
#include <grp.h>
#include <tqsocket.h> #include <tqsocket.h>
#include <tqserversocket.h> #include <tqserversocket.h>
#include <tqapplication.h> #include <tqapplication.h>
@ -73,6 +75,9 @@ class SysCtlSocket : public TDEKerberosServerSocket
TQSqlDatabase* m_workspaces_database; TQSqlDatabase* m_workspaces_database;
int m_commandLoopState; int m_commandLoopState;
gid_t m_minGID;
gid_t m_maxGID;
friend class UserMgmtServer; friend class UserMgmtServer;
}; };

@ -37,7 +37,7 @@
#include <kaboutdata.h> #include <kaboutdata.h>
#include <ksimpleconfig.h> #include <ksimpleconfig.h>
#include "admin_sys_ctl.h" #include "admin_user_mgmt.h"
static const char description[] = I18N_NOOP("RemoteFPGA System Administration User Management Server"); static const char description[] = I18N_NOOP("RemoteFPGA System Administration User Management Server");
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
KSimpleConfig config("remotefpga_adminusermgmtserver.conf", false); KSimpleConfig config("remotefpga_adminusermgmtserver.conf", false);
config.setGroup("Server"); config.setGroup("Server");
SysCtlServer fpgasvr(0, config.readNumEntry("port", 4016), &config); UserMgmtServer fpgasvr(0, config.readNumEntry("port", 4016), &config);
return app.exec(); return app.exec();
} }

@ -22,6 +22,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <grp.h>
#include <pwd.h>
#include <tqtimer.h> #include <tqtimer.h>
#include <klocale.h> #include <klocale.h>
@ -415,12 +418,43 @@ void AuthSocket::commandLoop() {
bool authorized = false; bool authorized = false;
bool in_use = false; bool in_use = false;
int ngroups = 0;
gid_t *groups;
struct passwd *pw;
struct group *gr;
groups = (gid_t*)malloc(ngroups*sizeof(gid_t));
if (groups == NULL) {
printf("[ERROR] Unable to allocate memory\n\r"); fflush(stdout);
exit(EXIT_FAILURE);
}
pw = getpwnam(m_authenticatedUserName.ascii());
if (pw == NULL) {
printf("[WARNING] Unable to get detailed information for user '%s', ignoring\n\r", m_authenticatedUserName.ascii()); fflush(stdout);
continue;
}
if (getgrouplist(m_authenticatedUserName.ascii(), pw->pw_gid, groups, &ngroups) == -1) {
free(groups);
groups = (gid_t*)malloc(ngroups*sizeof(gid_t));
if (getgrouplist(m_authenticatedUserName.ascii(), pw->pw_gid, groups, &ngroups) == -1) {
printf("[WARNING] Unable to get groups for user '%s', ignoring\n\r", m_authenticatedUserName.ascii()); fflush(stdout);
continue;
}
}
int i;
m_databasePermissionsCursor->select(TQString("station=%1").arg(m_databaseStationsCursor->value("pk").toInt())); m_databasePermissionsCursor->select(TQString("station=%1").arg(m_databaseStationsCursor->value("pk").toInt()));
while (m_databasePermissionsCursor->next()) { while (m_databasePermissionsCursor->next()) {
if (m_databasePermissionsCursor->value("username").toString() == m_authenticatedUserName) { for (i = 0; i < ngroups; i++) {
gr = getgrgid(groups[i]);
if (gr != NULL) {
if (m_databasePermissionsCursor->value("groupname").toString() == TQString(gr->gr_name)) {
authorized = true; authorized = true;
} }
} }
}
}
m_databaseActivityCursor->select(TQString("station=%1").arg(m_databaseStationsCursor->value("pk").toInt())); m_databaseActivityCursor->select(TQString("station=%1").arg(m_databaseStationsCursor->value("pk").toInt()));
while (m_databaseActivityCursor->next()) { while (m_databaseActivityCursor->next()) {
if (m_databaseActivityCursor->value("username").toString() != "") { if (m_databaseActivityCursor->value("username").toString() != "") {

Loading…
Cancel
Save