From 7cac7083095bad1af86f6847f90738e3ddbdaba1 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 22 Nov 2021 15:31:53 +0100 Subject: [PATCH 3/5] [clean] PEP8 cleanup --- flaschengeist/plugins/events/routes.py | 8 ++++---- flaschengeist/plugins/pricelist/__init__.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/flaschengeist/plugins/events/routes.py b/flaschengeist/plugins/events/routes.py index 780edcb..2771c72 100644 --- a/flaschengeist/plugins/events/routes.py +++ b/flaschengeist/plugins/events/routes.py @@ -15,7 +15,6 @@ from . import event_controller, permissions, EventPlugin from ...utils.HTTP import no_content - def dict_get(self, key, default=None, type=None): """Same as .get from MultiDict""" try: @@ -340,11 +339,11 @@ def modify_event(event_id, current_session): event.start = dict_get(data, "start", event.start, type=from_iso_format) event.end = dict_get(data, "end", event.end, type=from_iso_format) event.name = dict_get(data, "name", event.name, type=str) - event.description = dict_get(data, "description", event.description, type=str) + event.description = dict_get(data, "description", event.description, type=str) if "type" in data: event_type = event_controller.get_event_type(data["type"]) event.type = event_type - + event_controller.update() return jsonify(event) @@ -427,7 +426,7 @@ def update_job(event_id, job_id, current_session: Session): """ if not current_session.user_.has_permission(permissions.EDIT): raise Forbidden - + data = request.get_json() if not data: raise BadRequest @@ -510,4 +509,5 @@ def lock_job(job_id, current_session: Session): raise BadRequest return no_content() + # TODO: JobTransfer diff --git a/flaschengeist/plugins/pricelist/__init__.py b/flaschengeist/plugins/pricelist/__init__.py index 20bb30a..168136e 100644 --- a/flaschengeist/plugins/pricelist/__init__.py +++ b/flaschengeist/plugins/pricelist/__init__.py @@ -738,7 +738,7 @@ def set_picture(identifier, current_session): @PriceListPlugin.blueprint.route("/drinks//picture", methods=["GET"]) -#@headers({"Cache-Control": "private, must-revalidate"}) +# @headers({"Cache-Control": "private, must-revalidate"}) def _get_picture(identifier): """Get Picture From 471258c88693898a103e32c94c5fabf63650cbf3 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Mon, 22 Nov 2021 15:33:18 +0100 Subject: [PATCH 4/5] [events] Default jobs to unlocked state --- flaschengeist/plugins/events/models.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/flaschengeist/plugins/events/models.py b/flaschengeist/plugins/events/models.py index d1dee02..2cbfd6e 100644 --- a/flaschengeist/plugins/events/models.py +++ b/flaschengeist/plugins/events/models.py @@ -65,8 +65,10 @@ class Job(db.Model, ModelSerializeMixin): end: Optional[datetime] = db.Column(UtcDateTime) type: Union[JobType, int] = db.relationship("JobType") comment: Optional[str] = db.Column(db.String(256)) - locked: bool = db.Column(db.Boolean()) - services: list[Service] = db.relationship("Service", back_populates="job_") + locked: bool = db.Column(db.Boolean(), default=False, nullable=False) + services: list[Service] = db.relationship( + "Service", back_populates="job_", cascade="save-update, merge, delete, delete-orphan" + ) required_services: float = db.Column(db.Numeric(precision=4, scale=2, asdecimal=False), nullable=False) event_ = db.relationship("Event", back_populates="jobs") From eb04d305ab9806d0c96b3e5594bc4fe184658d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Sun, 21 Nov 2021 15:34:19 +0100 Subject: [PATCH 5/5] [auth_ldap] fix add displayName when create --- flaschengeist/plugins/auth_ldap/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flaschengeist/plugins/auth_ldap/__init__.py b/flaschengeist/plugins/auth_ldap/__init__.py index a872ce8..ebe84c3 100644 --- a/flaschengeist/plugins/auth_ldap/__init__.py +++ b/flaschengeist/plugins/auth_ldap/__init__.py @@ -113,6 +113,8 @@ class AuthLDAP(AuthPlugin): "mail": user.mail, } ) + if user.display_name: + attributes.update( {"displayName": user.display_name}) ldap_conn.add(dn, self.object_classes, attributes) self._set_roles(user) self.update_user(user)