From ff5e646daf436064db407481f11d1d9a1f8bf39d Mon Sep 17 00:00:00 2001 From: William Ronchetti Date: Fri, 11 Aug 2023 12:21:00 -0400 Subject: [PATCH] fix permission bug --- CHANGELOG.rst | 6 ++++++ pyproject.toml | 2 +- snovault/schema_utils.py | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 09fba9884..7a2042adb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,12 @@ snovault Change Log ---------- +10.0.2 +====== + +* Repair bug in ``permission`` implementation involving restricted fields + + 10.0.1 ====== diff --git a/pyproject.toml b/pyproject.toml index 54bd096c8..a90fb760a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "dcicsnovault" -version = "10.0.1" +version = "10.0.2" description = "Storage support for 4DN Data Portals." authors = ["4DN-DCIC Team "] license = "MIT" diff --git a/snovault/schema_utils.py b/snovault/schema_utils.py index 4a327eaf0..4258cb8be 100644 --- a/snovault/schema_utils.py +++ b/snovault/schema_utils.py @@ -277,6 +277,10 @@ class IgnoreUnchanged(ValidationError): pass +class SnoPermissionError(ValidationError): + pass + + def requestMethod(validator, requestMethod, instance, schema): ignored(instance, schema) if validator.is_type(requestMethod, "string"): @@ -300,7 +304,7 @@ def permission(validator, permission, instance, schema): context = request.context if not request.has_permission(permission, context): error = "permission %r required" % permission - yield IgnoreUnchanged(error) + yield SnoPermissionError(error) VALIDATOR_REGISTRY = {}