예제 #1
0
    def _revoke_consent(self, dest_pkey, src_pkey):
        consent_address = \
            helper.make_consent_address(dest_pkey=dest_pkey, src_pkey=src_pkey)

        consent_address_vice_versa = \
            helper.make_consent_address(dest_pkey=src_pkey, src_pkey=dest_pkey)

        self._context.delete_state(
            [consent_address, consent_address_vice_versa],
            timeout=self.TIMEOUT)
예제 #2
0
    def _store_decline_consent(self, dest_pkey, src_pkey):
        consent_address = \
            helper.make_consent_address(dest_pkey=dest_pkey, src_pkey=src_pkey)
        consent_address_vice_versa = \
            helper.make_consent_address(dest_pkey=src_pkey, src_pkey=dest_pkey)

        consent = consent_pb2.ActionOnAccess()
        consent.dest_pkey = dest_pkey
        consent.src_pkey = src_pkey
        consent.action_type = consent_pb2.ActionOnAccess.DECLINED

        state_data = consent.SerializeToString()
        self._context.set_state(
            {
                consent_address: state_data,
                consent_address_vice_versa: state_data
            },
            timeout=self.TIMEOUT)
예제 #3
0
 def _load_access(self, doctor_pkey, patient_pkey):
     access_hex = [helper.make_consent_address(dest_pkey=doctor_pkey, src_pkey=patient_pkey)]
     state_entries = self._context.get_state(
         access_hex,
         timeout=self.TIMEOUT)
     if state_entries:
         access = consent_payload_pb2.ActionOnAccess()
         access.ParseFromString(state_entries[0].data)
         return access
     return None
예제 #4
0
    def _store_access(self, doctor_key, patient_pkey):
        address = helper.make_consent_address(dest_pkey=doctor_key, src_pkey=patient_pkey)

        access = consent_payload_pb2.ActionOnAccess()
        access.doctor_pkey = doctor_key
        access.patient_pkey = patient_pkey

        state_data = access.SerializeToString()
        self._context.set_state(
            {address: state_data},
            timeout=self.TIMEOUT)
예제 #5
0
    def _revoke_access(self, doctor_key, patient_pkey):
        address = helper.make_consent_address(dest_pkey=doctor_key, src_pkey=patient_pkey)

        self._context.delete_state(
            [address],
            timeout=self.TIMEOUT)