remove remote filter lists

This commit is contained in:
chrys 2018-09-08 20:05:59 +02:00
parent 45921a4487
commit a0beb42e89
8 changed files with 16 additions and 52 deletions

View File

@ -198,12 +198,8 @@ port=22447
socketpath=/tmp/
# allow settings to overwrite
enableSettingsRemote=True
# permitted settings
allowSettings=barrier#enabled
# allow commands to be executed
enableCommandRemote=True
# permitted commands
allowCommands=say,interrupt,window,resetwindow
[barrier]
enabled=True

View File

@ -208,12 +208,8 @@ port=22447
socketpath=/tmp/
# allow settings to overwrite
enableSettingsRemote=True
# permitted settings
allowSettings=barrier#enabled
# allow commands to be executed
enableCommandRemote=True
# permitted commands
allowCommands=say,interrupt,window,resetwindow
[barrier]
enabled=True

View File

@ -209,12 +209,8 @@ port=22447
socketpath=/tmp/
# allow settings to overwrite
enableSettingsRemote=True
# permitted settings
allowSettings=barrier#enabled
# allow commands to be executed
enableCommandRemote=True
# permitted commands
allowCommands=say,interrupt,window,resetwindow
[barrier]
enabled=True

View File

@ -154,12 +154,8 @@ port=22447
socketpath=/tmp/
# allow settings to overwrite
enableSettingsRemote=True
# permitted settings
allowSettings=barrier#enabled
# allow commands to be executed
enableCommandRemote=True
# permitted commands
allowCommands=say,interrupt,window,resetwindow
[barrier]
enabled=True

View File

@ -208,12 +208,8 @@ port=22447
socketpath=/tmp/
# allow settings to overwrite
enableSettingsRemote=True
# permitted settings
allowSettings=barrier#enabled
# allow commands to be executed
enableCommandRemote=True
# permitted commands
allowCommands=say,interrupt,window,resetwindow
[barrier]
enabled=True

View File

@ -126,7 +126,7 @@ class remoteManager():
def handleSettingsChange(self, settingsText):
if not self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enableSettingsRemote'):
return
upperSettingsText = settingsText.upper()
# set setting
if upperSettingsText.startswith(self.setSettingConst):
@ -138,14 +138,9 @@ class remoteManager():
def handleCommandExecution(self, commandText):
if not self.env['runtime']['settingsManager'].getSettingAsBool('remote', 'enableCommandRemote'):
return
allowCommands = self.env['runtime']['settingsManager'].getSetting('remote', 'allowCommands').upper().split(',')
upperCommandText = commandText.upper()
allowed = False
for a in allowCommands:
if upperCommandText.startswith(a):
allowed = True
if not allowed:
return
# say
if upperCommandText.startswith(self.sayConst):
parameterText = commandText[len(self.sayConst):]
@ -184,9 +179,7 @@ class remoteManager():
def resetSettings(self):
self.env['runtime']['settingsManager'].resetSettingArgDict()
def setSettings(self, settingsArgs):
allowSettings = self.env['runtime']['settingsManager'].getSetting('remote', 'allowSettings').upper().split(',')
self.env['runtime']['settingsManager'].parseSettingArgs(settingsArgs, allowSettings)
self.env['runtime']['settingsManager'].parseSettingArgs(settingsArgs)
def handleRemoteIncomming(self, eventData):
if not eventData:
return

View File

@ -86,9 +86,7 @@ settingsData = {
'port': 22447,
'socketpath':'/tmp/',
'enableSettingsRemote': True,
'allowSettings': 'barrier#enabled',
'enableCommandRemote': True,
'allowCommands': 'say,interrupt,window,resetwindow',
},
'barrier':{
'enabled': True,

View File

@ -87,10 +87,10 @@ class settingsManager():
value = ''
try:
value = self.settingArgDict[section.lower()][setting.lower()]
return value
return value
except:
pass
try:
try:
value = self.env['settings'].get(section, setting)
except:
value = str(self.settings[section][setting])
@ -100,7 +100,7 @@ class settingsManager():
value = 0
try:
value = int(self.settingArgDict[section.lower()][setting.lower()])
return value
return value
except Exception as e:
pass
try:
@ -113,9 +113,9 @@ class settingsManager():
value = 0.0
try:
value = float(self.settingArgDict[section.lower()][setting.lower()])
return value
return value
except Exception as e:
pass
pass
try:
value = self.env['settings'].getfloat(section, setting)
except:
@ -160,7 +160,7 @@ class settingsManager():
try:
self.env['runtime'][driverType].shutdown()
except Exception as e:
pass
pass
del self.env['runtime'][driverType]
def setFenrirKeys(self, keys):
@ -185,21 +185,14 @@ class settingsManager():
except KeyError:
self.settingArgDict[section] = {}
self.settingArgDict[section][option] = str(value)
def parseSettingArgs(self, settingArgs, allowSettings = None):
def parseSettingArgs(self, settingArgs):
for optionElem in settingArgs.split(';'):
if len(optionElem.split('#',1)) != 2:
continue
if len(optionElem.split('#',1)[1].split('=',1)) != 2:
continue
allowed = False
if allowSettings:
for a in allowSettings:
if a in optionElem:
allowed = True
if not allowed:
continue
section = str(optionElem.split('#',1)[0]).lower()
option = str(optionElem.split('#',1)[1].split('=',1)[0]).lower()
value = optionElem.split('#',1)[1].split('=',1)[1]
@ -288,13 +281,13 @@ class settingsManager():
environment['runtime']['memoryManager'].initialize(environment)
environment['runtime']['attributeManager'] = attributeManager.attributeManager()
environment['runtime']['attributeManager'].initialize(environment)
environment['runtime']['attributeManager'].initialize(environment)
environment['runtime']['eventManager'] = eventManager.eventManager()
environment['runtime']['eventManager'].initialize(environment)
environment['runtime']['eventManager'].initialize(environment)
environment['runtime']['processManager'] = processManager.processManager()
environment['runtime']['processManager'].initialize(environment)
environment['runtime']['processManager'].initialize(environment)
environment['runtime']['outputManager'] = outputManager.outputManager()
environment['runtime']['outputManager'].initialize(environment)