Merge pull request #453 from eReuse/changes/4377-setup-page

fix pdf
This commit is contained in:
cayop 2023-05-31 11:19:02 +02:00 committed by GitHub
commit aab3addc20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View File

@ -501,7 +501,8 @@ class EraseBasic(JoinedWithOneDeviceMixin, ActionWithOneDevice):
v += '. ' v += '. '
if 's' in format_spec: if 's' in format_spec:
if self.standards: if self.standards:
std = 'with standards {}'.format(self.standards) standard = ','.join([x.value for x in self.standards])
std = 'with standards {}'.format(standard)
else: else:
std = 'no standard' std = 'no standard'
v += 'Method used: {}, {}. '.format(self.method, std) v += 'Method used: {}, {}. '.format(self.method, std)
@ -527,14 +528,15 @@ class EraseSectors(EraseBasic):
steps_random += 1 steps_random += 1
if s.type == 'StepZero': if s.type == 'StepZero':
steps_zeros += 1 steps_zeros += 1
if steps_zeros < 1:
if steps_zeros == 0 and steps_random == 1:
return "Basic" return "Basic"
if 0 < steps_random < 3: if steps_zeros == 1 and steps_random == 1:
return "Baseline" return "Baseline"
if steps_random > 2: if steps_zeros == 1 and steps_random == 2:
return "Enhanced" return "Enhanced"
return "Basic" return "Custom"
class ErasePhysical(EraseBasic): class ErasePhysical(EraseBasic):

View File

@ -365,16 +365,16 @@ class ErasureStandards(Enum):
"""Software erasure standards.""" """Software erasure standards."""
HMG_IS5 = 'British HMG Infosec Standard 5 (HMG IS5)' HMG_IS5 = 'British HMG Infosec Standard 5 (HMG IS5)'
"""`British HMG Infosec Standard 5 (HMG IS5) """`British HMG Infosec Standard 5 (HMG IS5)
<https://en.wikipedia.org/wiki/Infosec_Standard_5>`_. <https://en.wikipedia.org/wiki/Infosec_Standard_5>`_.
In order to follow this standard, an erasure must have the In order to follow this standard, an erasure must have the
following steps: following steps:
1. A first step writing zeroes to the data-storage units. 1. A first step writing zeroes to the data-storage units.
2. A second step erasing with random data, verifying the erasure 2. A second step erasing with random data, verifying the erasure
success in each hard-drive sector. success in each hard-drive sector.
And be an :class:`ereuse_devicehub.resources.action.models.EraseSectors`. And be an :class:`ereuse_devicehub.resources.action.models.EraseSectors`.
""" """
@ -394,6 +394,13 @@ class ErasureStandards(Enum):
isinstance(step, actions.StepRandom) for step in other_steps isinstance(step, actions.StepRandom) for step in other_steps
): ):
standards.add(cls.HMG_IS5) standards.add(cls.HMG_IS5)
if len(other_steps) == 2:
step1 = isinstance(first_step, actions.StepRandom)
step2 = isinstance(other_steps[0], actions.StepZero)
step3 = isinstance(other_steps[1], actions.StepRandom)
if step1 and step2 and step3:
standards.add(cls.HMG_IS5)
return standards return standards