/mandos/release

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/release

« back to all changes in this revision

Viewing changes to mandos-monitor

merge
new approve/deny functionallity in mandos-monitor

Show diffs side-by-side

added added

removed removed

Lines of Context:
57
57
        self.properties.update(
58
58
            self.proxy.GetAll(client_interface,
59
59
                              dbus_interface = dbus.PROPERTIES_IFACE))
60
 
        super(MandosClientPropertyCache, self).__init__(
61
 
            *args, **kwargs)
 
60
 
 
61
        #XXX This break good super behaviour!
 
62
#        super(MandosClientPropertyCache, self).__init__(
 
63
#            *args, **kwargs)
62
64
    
63
65
    def property_changed(self, property=None, value=None):
64
66
        """This is called whenever we get a PropertyChanged signal
184
186
                          u"bold-underline-blink":
185
187
                              u"bold-underline-blink-standout",
186
188
                          }
187
 
        
 
189
 
188
190
        # Rebuild focus and non-focus widgets using current properties
189
 
        self._text = (u'%(name)s: %(enabled)s'
190
 
                      % { u"name": self.properties[u"name"],
191
 
                          u"enabled":
192
 
                              (u"enabled"
193
 
                               if self.properties[u"enabled"]
194
 
                               else u"DISABLED")})
 
191
 
 
192
        # Base part of a client. Name!
 
193
        self._text = (u'%(name)s: '
 
194
                      % {u"name": self.properties[u"name"]})
 
195
 
 
196
        if self.properties[u"approved_pending"]:
 
197
            if self.properties[u"approved_by_default"]:
 
198
                self._text += u"Connection established to client. (d)eny?"
 
199
            else:
 
200
                self._text += u"Seeks approval to send secret. (a)pprove?"
 
201
        else:
 
202
            self._text += (u'%(enabled)s'
 
203
                           % {u"enabled":
 
204
                               (u"enabled"
 
205
                                if self.properties[u"enabled"]
 
206
                                else u"DISABLED")})
195
207
        if not urwid.supports_unicode():
196
208
            self._text = self._text.encode("ascii", "replace")
197
209
        textlist = [(u"normal", self._text)]
221
233
    def keypress(self, (maxcol,), key):
222
234
        """Handle keys.
223
235
        This overrides the method from urwid.FlowWidget"""
224
 
        if key == u"e" or key == u"+":
225
 
            self.proxy.Enable()
226
 
        elif key == u"d" or key == u"-":
227
 
            self.proxy.Disable()
 
236
        if key == u"+":
 
237
            self.proxy.Enable(dbus_interface = client_interface)
 
238
        elif key == u"-":
 
239
            self.proxy.Disable(dbus_interface = client_interface)
 
240
        elif key == u"a":
 
241
            self.proxy.Approve(dbus.Boolean(True, variant_level=1),
 
242
                               dbus_interface = client_interface)
 
243
        elif key == u"d":
 
244
            self.proxy.Approve(dbus.Boolean(False, variant_level=1),
 
245
                                  dbus_interface = client_interface)
228
246
        elif key == u"r" or key == u"_" or key == u"ctrl k":
229
247
            self.server_proxy_object.RemoveClient(self.proxy
230
248
                                                  .object_path)
231
249
        elif key == u"s":
232
 
            self.proxy.StartChecker()
 
250
            self.proxy.StartChecker(dbus_interface = client_interface)
233
251
        elif key == u"S":
234
 
            self.proxy.StopChecker()
 
252
            self.proxy.StopChecker(dbus_interface = client_interface)
235
253
        elif key == u"C":
236
 
            self.proxy.CheckedOK()
 
254
            self.proxy.CheckedOK(dbus_interface = client_interface)
237
255
        # xxx
238
256
#         elif key == u"p" or key == "=":
239
257
#             self.proxy.pause()
241
259
#             self.proxy.unpause()
242
260
#         elif key == u"RET":
243
261
#             self.open()
244
 
        elif key == u"+":
245
 
            self.proxy.Approve(True)
246
 
        elif key == u"-":
247
 
            self.proxy.Approve(False)
 
262
#        elif key == u"+":
 
263
#            self.proxy.Approve(True)
 
264
#        elif key == u"-":
 
265
#            self.proxy.Approve(False)
248
266
        else:
249
267
            return key
250
268
    
547
565
                                             u"r: Remove",
548
566
                                             u"s: Start new checker",
549
567
                                             u"S: Stop checker",
550
 
                                             u"C: Checker OK"))))
 
568
                                             u"C: Checker OK",
 
569
                                             u"A: Approve",
 
570
                                             u"D: Deny"))))
551
571
                self.refresh()
552
572
            elif key == u"tab":
553
573
                if self.topwidget.get_focus() is self.logbox: