916
# approved_pending - property
923
# ApprovalPending - property
917
924
@dbus_service_property(_interface, signature=u"b", access=u"read")
918
def approved_pending_dbus_property(self):
925
def ApprovalPending_dbus_property(self):
919
926
return dbus.Boolean(bool(self.approvals_pending))
921
# approved_by_default - property
928
# ApprovedByDefault - property
922
929
@dbus_service_property(_interface, signature=u"b",
923
930
access=u"readwrite")
924
def approved_by_default_dbus_property(self):
925
return dbus.Boolean(self.approved_by_default)
927
# approved_delay - property
928
@dbus_service_property(_interface, signature=u"t",
930
def approved_delay_dbus_property(self):
931
return dbus.UInt64(self.approved_delay_milliseconds())
933
# approved_duration - property
934
@dbus_service_property(_interface, signature=u"t",
936
def approved_duration_dbus_property(self):
937
return dbus.UInt64(self._timedelta_to_milliseconds(
938
self.approved_duration))
931
def ApprovedByDefault_dbus_property(self, value=None):
932
if value is None: # get
933
return dbus.Boolean(self.approved_by_default)
934
self.approved_by_default = bool(value)
936
self.PropertyChanged(dbus.String(u"ApprovedByDefault"),
937
dbus.Boolean(value, variant_level=1))
939
# ApprovalDelay - property
940
@dbus_service_property(_interface, signature=u"t",
942
def ApprovalDelay_dbus_property(self, value=None):
943
if value is None: # get
944
return dbus.UInt64(self.approval_delay_milliseconds())
945
self.approval_delay = datetime.timedelta(0, 0, 0, value)
947
self.PropertyChanged(dbus.String(u"ApprovalDelay"),
948
dbus.UInt64(value, variant_level=1))
950
# ApprovalDuration - property
951
@dbus_service_property(_interface, signature=u"t",
953
def ApprovalDuration_dbus_property(self, value=None):
954
if value is None: # get
955
return dbus.UInt64(self._timedelta_to_milliseconds(
956
self.approval_duration))
957
self.approval_duration = datetime.timedelta(0, 0, 0, value)
959
self.PropertyChanged(dbus.String(u"ApprovalDuration"),
960
dbus.UInt64(value, variant_level=1))
941
963
@dbus_service_property(_interface, signature=u"s", access=u"read")
942
def name_dbus_property(self):
964
def Name_dbus_property(self):
943
965
return dbus.String(self.name)
945
# fingerprint - property
967
# Fingerprint - property
946
968
@dbus_service_property(_interface, signature=u"s", access=u"read")
947
def fingerprint_dbus_property(self):
969
def Fingerprint_dbus_property(self):
948
970
return dbus.String(self.fingerprint)
951
973
@dbus_service_property(_interface, signature=u"s",
952
974
access=u"readwrite")
953
def host_dbus_property(self, value=None):
975
def Host_dbus_property(self, value=None):
954
976
if value is None: # get
955
977
return dbus.String(self.host)
956
978
self.host = value
957
979
# Emit D-Bus signal
958
self.PropertyChanged(dbus.String(u"host"),
980
self.PropertyChanged(dbus.String(u"Host"),
959
981
dbus.String(value, variant_level=1))
962
984
@dbus_service_property(_interface, signature=u"s", access=u"read")
963
def created_dbus_property(self):
985
def Created_dbus_property(self):
964
986
return dbus.String(self._datetime_to_dbus(self.created))
966
# last_enabled - property
988
# LastEnabled - property
967
989
@dbus_service_property(_interface, signature=u"s", access=u"read")
968
def last_enabled_dbus_property(self):
990
def LastEnabled_dbus_property(self):
969
991
if self.last_enabled is None:
970
992
return dbus.String(u"")
971
993
return dbus.String(self._datetime_to_dbus(self.last_enabled))
974
996
@dbus_service_property(_interface, signature=u"b",
975
997
access=u"readwrite")
976
def enabled_dbus_property(self, value=None):
998
def Enabled_dbus_property(self, value=None):
977
999
if value is None: # get
978
1000
return dbus.Boolean(self.enabled)
993
1015
return dbus.String(self._datetime_to_dbus(self
994
1016
.last_checked_ok))
1018
# Timeout - property
997
1019
@dbus_service_property(_interface, signature=u"t",
998
1020
access=u"readwrite")
999
def timeout_dbus_property(self, value=None):
1021
def Timeout_dbus_property(self, value=None):
1000
1022
if value is None: # get
1001
1023
return dbus.UInt64(self.timeout_milliseconds())
1002
1024
self.timeout = datetime.timedelta(0, 0, 0, value)
1003
1025
# Emit D-Bus signal
1004
self.PropertyChanged(dbus.String(u"timeout"),
1026
self.PropertyChanged(dbus.String(u"Timeout"),
1005
1027
dbus.UInt64(value, variant_level=1))
1006
1028
if getattr(self, u"disable_initiator_tag", None) is None:
1021
1043
self.disable_initiator_tag = (gobject.timeout_add
1022
1044
(time_to_die, self.disable))
1024
# interval - property
1046
# Interval - property
1025
1047
@dbus_service_property(_interface, signature=u"t",
1026
1048
access=u"readwrite")
1027
def interval_dbus_property(self, value=None):
1049
def Interval_dbus_property(self, value=None):
1028
1050
if value is None: # get
1029
1051
return dbus.UInt64(self.interval_milliseconds())
1030
1052
self.interval = datetime.timedelta(0, 0, 0, value)
1031
1053
# Emit D-Bus signal
1032
self.PropertyChanged(dbus.String(u"interval"),
1054
self.PropertyChanged(dbus.String(u"Interval"),
1033
1055
dbus.UInt64(value, variant_level=1))
1034
1056
if getattr(self, u"checker_initiator_tag", None) is None:
1039
1061
(value, self.start_checker))
1040
1062
self.start_checker() # Start one now, too
1042
# checker - property
1064
# Checker - property
1043
1065
@dbus_service_property(_interface, signature=u"s",
1044
1066
access=u"readwrite")
1045
def checker_dbus_property(self, value=None):
1067
def Checker_dbus_property(self, value=None):
1046
1068
if value is None: # get
1047
1069
return dbus.String(self.checker_command)
1048
1070
self.checker_command = value
1049
1071
# Emit D-Bus signal
1050
self.PropertyChanged(dbus.String(u"checker"),
1072
self.PropertyChanged(dbus.String(u"Checker"),
1051
1073
dbus.String(self.checker_command,
1052
1074
variant_level=1))
1054
# checker_running - property
1076
# CheckerRunning - property
1055
1077
@dbus_service_property(_interface, signature=u"b",
1056
1078
access=u"readwrite")
1057
def checker_running_dbus_property(self, value=None):
1079
def CheckerRunning_dbus_property(self, value=None):
1058
1080
if value is None: # get
1059
1081
return dbus.Boolean(self.checker is not None)
1188
1210
client.Rejected("Disabled")
1191
if client._approved or not client.approved_delay:
1213
if client._approved or not client.approval_delay:
1192
1214
#We are approved or approval is disabled
1194
1216
elif client._approved is None:
1195
logger.info(u"Client %s need approval",
1217
logger.info(u"Client %s needs approval",
1197
1219
if self.server.use_dbus:
1198
1220
# Emit D-Bus signal
1199
1221
client.NeedApproval(
1200
client.approved_delay_milliseconds(),
1222
client.approval_delay_milliseconds(),
1201
1223
client.approved_by_default)
1203
1225
logger.warning(u"Client %s was not approved",
1205
1227
if self.server.use_dbus:
1206
1228
# Emit D-Bus signal
1207
client.Rejected("Disapproved")
1229
client.Rejected("Denied")
1210
1232
#wait until timeout or approved