diff --git a/bhjwt/assertions/main.py b/bhjwt/assertions/main.py index 9f86e28..0a59f2c 100644 --- a/bhjwt/assertions/main.py +++ b/bhjwt/assertions/main.py @@ -22,11 +22,16 @@ def is_data_resource_user_of(self, data_resource_id): self._is_data_resource_role_of(data_resource_id, "user") def _has_permission_to_data_resource(self, data_resource_id: str, permission: str) -> None: - data_resource_claim = self.claims["brighthive-data-resource-claims"].get(data_resource_id) data_perm = f"data:{permission.lower()}" - assertion = ("brighthive-data-resource-claims" in self.claims and - data_resource_claim is not None and - data_perm in data_resource_claim.get("permissions", [])) + assertion = ( + "brighthive-data-resource-claims" in self.claims + and self.claims["brighthive-data-resource-claims"].get(data_resource_id) + is not None + and permission + in self.claims["brighthive-data-resource-claims"] + .get(data_resource_id) + .get("permissions", []) + ) self.assertions.append(assertion) def has_edit_to_data_resource(self, data_resource_id):