Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 5f8a2c07

Přidáno uživatelem Michal Seják před asi 4 roky(ů)

Re #8572 - Extended the method in the CertificateService.

Zobrazit rozdíly:

src/services/certificate_service.py
256 256

  
257 257
        return chain_of_trust
258 258

  
259
    def delete_certificate(self, unique_id) -> bool:
259
    def delete_certificate(self, unique_id):
260 260
        """
261
        Deletes a certificate
261
        Deletes a certificate. Raises an Exception should any unexpected behavior occur.
262 262

  
263 263
        :param unique_id: ID of specific certificate
264

  
265
        :return: `True` when the deletion was successful. `False` in other case
266 264
        """
267
        # TODO delete children?
268
        return self.certificate_repository.delete(unique_id)
265

  
266
        to_delete = self.certificate_repository.get_all_descendants_of(unique_id)
267
        if to_delete is None:
268
            raise CertificateNotFoundException(unique_id)
269

  
270
        for cert in to_delete:
271
            try:
272
                self.set_certificate_revocation_status(cert.certificate_id, STATUS_REVOKED)
273
            except CertificateAlreadyRevokedException:
274
                # TODO log as an info/debug, not warning or above <-- perfectly legal
275
                continue
276

  
277
            self.certificate_repository.delete(cert.certificate_id)
278
            # TODO log if not successfully deleted
269 279

  
270 280
    def set_certificate_revocation_status(self, id, status, reason="unspecified"):
271 281
        """

Také k dispozici: Unified diff