ComputerControlServer::ComputerControlServer() : QObject(), m_allowedIPs(), m_failedAuthHosts(), m_builtinFeatures(), m_featureManager(), m_featureWorkerManager( m_featureManager ), m_serverAuthenticationManager( this ), m_serverAccessControlManager( m_featureWorkerManager, m_builtinFeatures.desktopAccessDialog(), this ), m_vncServer(), m_vncProxyServer( VeyonCore::config().localConnectOnly() || AccessControlProvider().isAccessToLocalComputerDenied() ? QHostAddress::LocalHost : QHostAddress::Any, VeyonCore::config().primaryServicePort(), this, this ) { m_builtinFeatures.systemTrayIcon().setToolTip( tr( "%1 Service %2 at %3:%4" ).arg( VeyonCore::applicationName(), VEYON_VERSION, QHostInfo::localHostName(), QString::number( VeyonCore::config().primaryServicePort() ) ), m_featureWorkerManager ); // make app terminate once the VNC server thread has finished connect( &m_vncServer, &VncServer::finished, QCoreApplication::instance(), &QCoreApplication::quit ); connect( &m_serverAuthenticationManager, &ServerAuthenticationManager::authenticationError, this, &ComputerControlServer::showAuthenticationErrorMessage ); }
bool ServerAccessControlManager::performAccessControl( VncServerClient* client, DesktopAccessPermission::AuthenticationMethod authenticationMethod ) { auto accessResult = AccessControlProvider().checkAccess( client->username(), client->hostAddress(), connectedUsers() ); DesktopAccessPermission desktopAccessPermission( authenticationMethod ); switch( accessResult ) { case AccessControlProvider::AccessToBeConfirmed: return desktopAccessPermission.ask( m_featureWorkerManager, m_desktopAccessDialog, client->username(), client->hostAddress() ); case AccessControlProvider::AccessAllow: if( desktopAccessPermission.authenticationMethodRequiresConfirmation() ) { return desktopAccessPermission.ask( m_featureWorkerManager, m_desktopAccessDialog, client->username(), client->hostAddress() ); } return true; default: break; } return false; }
void AccessControlPage::testUserGroupsAccessControl() { QString username = QInputDialog::getText( this, tr( "Enter username" ), tr( "Please enter a user login name whose access permissions to test:" ) ); if( AccessControlProvider().processAuthorizedGroups( username ) ) { QMessageBox::information( this, tr( "Access allowed" ), tr( "The specified user is allowed to access computers with this configuration." ) ); } else { QMessageBox::warning( this, tr( "Access denied" ), tr( "The specified user is not allowed to access computers with this configuration." ) ); } }