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