diff --git a/CHANGELOG.md b/CHANGELOG.md index 771b1d4a..f52352dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,22 @@ ml). ## testing +## [2.5.3] - 2023-05-13 +- [added] #450 add new datawipe in csv. +- [changed] #447 Share a lot between 2 users, one is owner the other is read only. +- [changed] #448 enhancements in export lots. +- [changed] #449 remove button of submit in filter of list of devices. +- [changed] #452 New version of settings for workbench. +- [fixed] #445 required File for new documents bat optional for edit document. +- [fixed] #446 Fix id_supplier and id_internal in export devices. +- [fixed] #451 fix new datawipe in certificate erasure. +- [fixed] #453 fix value method in certificate erasure. +- [fixed] #454 remove validation of email for placeholders type mobile. +- [fixed] #455 add placeholders in csv metrics and pdf certificate. +- [fixed] #456 upload placeholders with type datastorage. +- [fixed] #457 change format erase datawipe. +- [fixed] #458 not datawipe for placeholders computers. + ## [2.5.2] - 2023-04-20 - [added] #414 add new vars in the settings file for wb. - [added] #440 add lots in export devices. diff --git a/ereuse_devicehub/__init__.py b/ereuse_devicehub/__init__.py index 667b52f9..43b48b6f 100644 --- a/ereuse_devicehub/__init__.py +++ b/ereuse_devicehub/__init__.py @@ -1 +1 @@ -__version__ = "2.5.2" +__version__ = "2.5.3" diff --git a/ereuse_devicehub/inventory/forms.py b/ereuse_devicehub/inventory/forms.py index 41a3b1ca..b4577260 100644 --- a/ereuse_devicehub/inventory/forms.py +++ b/ereuse_devicehub/inventory/forms.py @@ -29,6 +29,7 @@ from wtforms import ( ) from wtforms.fields import FormField +from ereuse_devicehub import messages from ereuse_devicehub.db import db from ereuse_devicehub.inventory.models import ( DeliveryNote, @@ -1093,6 +1094,21 @@ class DataWipeDocumentForm(Form): class DataWipeForm(ActionFormMixin): document = FormField(DataWipeDocumentForm) + def validate(self, extra_validators=None): + is_valid = super().validate(extra_validators) + if not is_valid: + return False + + txt = "Error: Only Data Sanitization actions are " + txt += "allowed on Placeholders that are of the Data Storage type." + for dev in self._devices: + if dev.is_abstract() == 'Placeholder': + if not (isinstance(dev, DataStorage) or isinstance(dev, Mobile)): + messages.error(txt) + return False + + return is_valid + def save(self): self.document.form.save(commit=False) diff --git a/ereuse_devicehub/migrations/versions/5169765e2653_add_new_erase_data_wipe.py b/ereuse_devicehub/migrations/versions/5169765e2653_add_new_erase_data_wipe.py index 1621a547..1b35b469 100644 --- a/ereuse_devicehub/migrations/versions/5169765e2653_add_new_erase_data_wipe.py +++ b/ereuse_devicehub/migrations/versions/5169765e2653_add_new_erase_data_wipe.py @@ -11,7 +11,7 @@ from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '5169765e2653' -down_revision = '2f2ef041483a' +down_revision = 'a8a86dbd5f51' branch_labels = None depends_on = None diff --git a/ereuse_devicehub/migrations/versions/a8a86dbd5f51_add_rols_to_user.py b/ereuse_devicehub/migrations/versions/a8a86dbd5f51_add_rols_to_user.py new file mode 100644 index 00000000..37424108 --- /dev/null +++ b/ereuse_devicehub/migrations/versions/a8a86dbd5f51_add_rols_to_user.py @@ -0,0 +1,35 @@ +"""add rols to user + +Revision ID: a8a86dbd5f51 +Revises: 5169765e2653 +Create Date: 2023-06-14 15:04:03.478157 + +""" +import citext +import sqlalchemy as sa +from alembic import context, op + +# revision identifiers, used by Alembic. +revision = 'a8a86dbd5f51' +down_revision = '2f2ef041483a' +branch_labels = None +depends_on = None + + +def get_inv(): + INV = context.get_x_argument(as_dictionary=True).get('inventory') + if not INV: + raise ValueError("Inventory value is not specified") + return INV + + +def upgrade(): + op.add_column( + 'user', + sa.Column('rols_dlt', type_=citext.CIText(), nullable=True), + schema='common', + ) + + +def downgrade(): + op.drop_column('user', 'rols_dlt', schema='common') diff --git a/ereuse_devicehub/resources/action/models.py b/ereuse_devicehub/resources/action/models.py index 942dd1b9..43fc1611 100644 --- a/ereuse_devicehub/resources/action/models.py +++ b/ereuse_devicehub/resources/action/models.py @@ -615,7 +615,7 @@ class EraseDataWipe(EraseBasic): def __format__(self, format_spec: str) -> str: v = '' if 't' in format_spec: - v += '{} {}.'.format(self.type, self.severity) + v += '{} {}. '.format(self.type, self.severity.get_public_name()) if 's' in format_spec: if not self.document: v += 'On {}'.format(self.date_str) diff --git a/ereuse_devicehub/resources/user/models.py b/ereuse_devicehub/resources/user/models.py index fee89686..d1caf715 100644 --- a/ereuse_devicehub/resources/user/models.py +++ b/ereuse_devicehub/resources/user/models.py @@ -33,6 +33,7 @@ class User(UserMixin, Thing): active = Column(Boolean, default=True, nullable=False) phantom = Column(Boolean, default=False, nullable=False) api_keys_dlt = Column(CIText(), nullable=True) + rols_dlt = Column(CIText(), nullable=True) inventories = db.relationship( Inventory, backref=db.backref('users', lazy=True, collection_class=set),