use percents instead of asterisks to better support db syntax w/ burnettk
This commit is contained in:
parent
0c116ae804
commit
22ba89ae4f
|
@ -19,7 +19,7 @@ class PermissionTargetModel(SpiffworkflowBaseDBModel):
|
|||
|
||||
@validates("uri")
|
||||
def validate_uri(self, key: str, value: str) -> str:
|
||||
if re.search(r"\*.", value):
|
||||
if re.search(r"%.", value):
|
||||
raise InvalidPermissionTargetUri(
|
||||
f"Invalid Permission Target Uri: {value}"
|
||||
)
|
||||
|
|
|
@ -65,7 +65,6 @@ class AuthorizationService:
|
|||
principals.append(group.principal)
|
||||
|
||||
return cls.has_permission(principals, permission, target_uri)
|
||||
# return False
|
||||
|
||||
# def refresh_token(self, token: str) -> str:
|
||||
# """Refresh_token."""
|
||||
|
|
|
@ -12,7 +12,7 @@ class TestPermissionTarget(BaseTest):
|
|||
def test_asterisk_must_go_at_the_end_of_uri(
|
||||
self, app: Flask, with_db_and_bpmn_file_cleanup: None
|
||||
) -> None:
|
||||
permission_target = PermissionTargetModel(uri="/test_group/*")
|
||||
permission_target = PermissionTargetModel(uri="/test_group/%")
|
||||
db.session.add(permission_target)
|
||||
db.session.commit()
|
||||
|
||||
|
@ -21,7 +21,7 @@ class TestPermissionTarget(BaseTest):
|
|||
db.session.commit()
|
||||
|
||||
with pytest.raises(InvalidPermissionTargetUri) as exception:
|
||||
PermissionTargetModel(uri="/test_group/*/model")
|
||||
PermissionTargetModel(uri="/test_group/%/model")
|
||||
assert (
|
||||
str(exception.value) == "Invalid Permission Target Uri: /test_group/*/model"
|
||||
str(exception.value) == "Invalid Permission Target Uri: /test_group/%/model"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue