core: added the security_limit to setParam
- params with a security greater than security_limit can not be modified - special value: security_limit < 0 disable the check (all params can be modified)
This commit is contained in:
parent
5366490603
commit
2bf3694fd0
7 changed files with 56 additions and 37 deletions
|
|
@ -199,8 +199,8 @@ class DBusBridgeFrontend(BridgeFrontend):
|
|||
def sendMessage(self, to_jid, message, subject='', mess_type="auto", options={}, profile_key="@NONE@"):
|
||||
return self.db_core_iface.sendMessage(to_jid, message, subject, mess_type, options, profile_key)
|
||||
|
||||
def setParam(self, name, value, category, profile_key="@DEFAULT@"):
|
||||
return self.db_core_iface.setParam(name, value, category, profile_key)
|
||||
def setParam(self, name, value, category, security_limit=-1, profile_key="@DEFAULT@"):
|
||||
return self.db_core_iface.setParam(name, value, category, security_limit, profile_key)
|
||||
|
||||
def setPresence(self, to_jid='', show='', priority=0, statuses={}, profile_key="@DEFAULT@"):
|
||||
return self.db_core_iface.setPresence(to_jid, show, priority, statuses, profile_key)
|
||||
|
|
|
|||
|
|
@ -525,8 +525,7 @@ class PrimitivusApp(QuickApp):
|
|||
self.addWindow(XMLUI(self,xml_data=params))
|
||||
def failure(error):
|
||||
self.showPopUp(sat_widgets.Alert(_("Error"), _("Can't get parameters"), ok_cb=self.removePopUp))
|
||||
security_limit = -1
|
||||
self.bridge.getParamsUI(security_limit, self.profile, callback=success, errback=failure)
|
||||
self.bridge.getParamsUI(profile_key=self.profile, callback=success, errback=failure)
|
||||
|
||||
|
||||
def onExitRequest(self, menu):
|
||||
|
|
|
|||
|
|
@ -141,10 +141,10 @@ class ProfileManager(urwid.WidgetWrap):
|
|||
new_pass = self.pass_wid.get_edit_text()
|
||||
|
||||
if old_jid != new_jid:
|
||||
self.host.bridge.setParam("JabberID", new_jid, "Connection", profile)
|
||||
self.host.bridge.setParam("Server", JID(new_jid).domain, "Connection", profile)
|
||||
self.host.bridge.setParam("JabberID", new_jid, "Connection", profile_key=profile)
|
||||
self.host.bridge.setParam("Server", JID(new_jid).domain, "Connection", profile_key=profile)
|
||||
if old_pass != new_pass:
|
||||
self.host.bridge.setParam("Password", new_pass, "Connection", profile)
|
||||
self.host.bridge.setParam("Password", new_pass, "Connection", profile_key=profile)
|
||||
self.host.plug_profile(profile)
|
||||
|
||||
def getParamError(self, ignore):
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ def getText(node):
|
|||
data.append(child.wholeText)
|
||||
return u"".join(data)
|
||||
|
||||
|
||||
class Pairs(urwid.WidgetWrap):
|
||||
|
||||
def __init__(self, weight_0='1', weight_1='1'):
|
||||
|
|
@ -274,5 +275,6 @@ class XMLUI(urwid.WidgetWrap):
|
|||
value = "true" if ctrl.get_state() else "false"
|
||||
else:
|
||||
value = ctrl.get_edit_text()
|
||||
self.host.bridge.setParam(ctrl._param_name, value, ctrl._param_category, profile_key = self.host.profile)
|
||||
self.host.bridge.setParam(ctrl._param_name, value, ctrl._param_category,
|
||||
profile_key=self.host.profile)
|
||||
self.host.removeWindow()
|
||||
|
|
|
|||
|
|
@ -363,8 +363,7 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
|
||||
def onParam(self, e):
|
||||
debug(_("Param request"))
|
||||
#security_limit = -1
|
||||
#xmlui = self.bridge.getParamsUI(security_limit, profile_key=self.profile)
|
||||
#xmlui = self.bridge.getParamsUI(profile_key=self.profile)
|
||||
#XMLUI(self, xml_data = xmlui)
|
||||
param=Param(self)
|
||||
|
||||
|
|
|
|||
|
|
@ -103,7 +103,6 @@ class Param(wx.Frame):
|
|||
cat_dom.unlink()
|
||||
|
||||
self.host.bridge.getParamsForCategory(category,
|
||||
security_limit=-1,
|
||||
profile_key=self.host.profile,
|
||||
callback=gotParams,
|
||||
errback=errorGettingParams)
|
||||
|
|
@ -137,7 +136,8 @@ class Param(wx.Frame):
|
|||
|
||||
def __save_parameters(self):
|
||||
for param in self.modified:
|
||||
self.host.bridge.setParam(param[0], self.modified[param], param[1], profile_key = self.host.profile)
|
||||
self.host.bridge.setParam(param[0], self.modified[param], param[1],
|
||||
profile_key=self.host.profile)
|
||||
self.modified.clear()
|
||||
|
||||
def onClose(self, event):
|
||||
|
|
|
|||
|
|
@ -145,11 +145,11 @@ class ProfileManager(wx.Panel):
|
|||
new_pass = self.login_pass.GetValue()
|
||||
if old_jid != new_jid:
|
||||
debug(_('Saving new JID and server'))
|
||||
self.host.bridge.setParam("JabberID", new_jid, "Connection", profile)
|
||||
self.host.bridge.setParam("Server", JID(new_jid).domain, "Connection", profile)
|
||||
self.host.bridge.setParam("JabberID", new_jid, "Connection", profile_key=profile)
|
||||
self.host.bridge.setParam("Server", JID(new_jid).domain, "Connection", profile_key=profile)
|
||||
if old_pass != new_pass:
|
||||
debug(_('Saving new password'))
|
||||
self.host.bridge.setParam("Password", new_pass, "Connection", profile)
|
||||
self.host.bridge.setParam("Password", new_pass, "Connection", profile_key=profile)
|
||||
self.host.plug_profile(profile)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue