Exemple #1
0
    def _store_data_processing_access(self, dest_pkey, src_pkey):
        address = helper.make_data_processing_access_address(
            dest_pkey=dest_pkey, src_pkey=src_pkey)
        access = consent_payload_pb2.ActionOnAccess()
        access.dest_pkey = dest_pkey
        access.src_pkey = src_pkey

        state_data = access.SerializeToString()
        self._context.set_state({address: state_data}, timeout=self.TIMEOUT)
 def _load_access_by_doctor(self, doctor_pkey):
     access_hex = [helper.make_consent_list_address_by_destination_client(dest_pkey=doctor_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
Exemple #3
0
 def _load_data_processing_access(self, dest_pkey, src_pkey):
     access_hex = [
         helper.make_data_processing_access_address(dest_pkey=dest_pkey,
                                                    src_pkey=src_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
Exemple #4
0
    def _store_request_inform_document_consent(self, dest_pkey, src_pkey):
        address = helper.make_request_inform_document_consent_address(
            dest_pkey=dest_pkey, src_pkey=src_pkey)
        address_vice_versa = helper.make_request_inform_document_consent_address(
            dest_pkey=src_pkey, src_pkey=dest_pkey)

        access = consent_payload_pb2.ActionOnAccess()
        access.dest_pkey = dest_pkey
        access.src_pkey = src_pkey

        state_data = access.SerializeToString()
        self._context.set_state(
            {
                address: state_data,
                address_vice_versa: state_data
            },
            timeout=self.TIMEOUT)
Exemple #5
0
    def _store_sign_inform_consent(self, dest_pkey, src_pkey):
        request_inform_consent_address = \
            helper.make_request_inform_document_consent_address(dest_pkey=dest_pkey, src_pkey=src_pkey)
        request_inform_consent_address_vice_versa = \
            helper.make_request_inform_document_consent_address(dest_pkey=src_pkey, src_pkey=dest_pkey)
        sign_inform_consent_address = \
            helper.make_sign_inform_document_consent_address(dest_pkey=dest_pkey, src_pkey=src_pkey)

        sign_inform_consent = consent_payload_pb2.ActionOnAccess()
        sign_inform_consent.dest_pkey = dest_pkey
        sign_inform_consent.src_pkey = src_pkey

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

        state_data = sign_inform_consent.SerializeToString()
        self._context.set_state({sign_inform_consent_address: state_data},
                                timeout=self.TIMEOUT)
Exemple #6
0
    def _store_sign_inform_consent(self, dest_pkey, src_pkey):
        request_inform_consent_address = \
            helper.make_request_inform_document_consent_address(dest_pkey=dest_pkey, src_pkey=src_pkey)
        request_inform_consent_address_vice_versa = \
            helper.make_request_inform_document_consent_address(dest_pkey=src_pkey, src_pkey=dest_pkey)
        sign_inform_consent_address = \
            helper.make_sign_inform_document_consent_address(dest_pkey=dest_pkey, src_pkey=src_pkey)

        sign_inform_consent = consent_payload_pb2.ActionOnAccess()
        sign_inform_consent.dest_pkey = dest_pkey
        sign_inform_consent.src_pkey = src_pkey

        states = [
            request_inform_consent_address,
            request_inform_consent_address_vice_versa
        ]
        LOGGER.debug("before delete_state: " + str(states))
        self._context.delete_state(states, timeout=self.TIMEOUT)
        LOGGER.debug("after delete_state: " + str(states))
        state_data = sign_inform_consent.SerializeToString()
        LOGGER.debug("before set_state")
        self._context.set_state({sign_inform_consent_address: state_data},
                                timeout=self.TIMEOUT)
        LOGGER.debug("after set_state")