postgres does not use backticks w/ burnettk

This commit is contained in:
jasquat 2022-10-11 11:48:19 -04:00
parent 621ad3ef2e
commit 0c116ae804
2 changed files with 1 additions and 15 deletions

View File

@ -5,12 +5,6 @@ from sqlalchemy.orm import validates
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
# process groups and models are not in the db
# from sqlalchemy import ForeignKey # type: ignore
#
# from spiffworkflow_backend.models.process_group import ProcessGroupModel
# from spiffworkflow_backend.models.process_model import ProcessModel
class InvalidPermissionTargetUri(Exception):
pass
@ -19,17 +13,9 @@ class PermissionTargetModel(SpiffworkflowBaseDBModel):
"""PermissionTargetModel."""
__tablename__ = "permission_target"
# __table_args__ = (
# CheckConstraint(
# "NOT(process_group_id IS NULL AND process_model_identifier IS NULL AND process_instance_id IS NULL)"
# ),
# )
id = db.Column(db.Integer, primary_key=True)
uri = db.Column(db.String(255), unique=True, nullable=False)
# process_group_id = db.Column(ForeignKey(ProcessGroupModel.id), nullable=True) # type: ignore
# process_model_identifier = db.Column(ForeignKey(ProcessModel.id), nullable=True) # type: ignore
# process_instance_id = db.Column(ForeignKey(ProcessInstanceModel.id), nullable=True) # type: ignore
@validates("uri")
def validate_uri(self, key: str, value: str) -> str:

View File

@ -31,7 +31,7 @@ class AuthorizationService:
)
.filter_by(permission=permission)
.join(PermissionTargetModel)
.filter(text(f"'{target_uri}' LIKE `permission_target`.`uri`"))
.filter(text(f"'{target_uri}' LIKE permission_target.uri"))
.all()
)