Skip to content

Commit

Permalink
Add a missing provider type check
Browse files Browse the repository at this point in the history
  • Loading branch information
akheron committed Dec 19, 2024
1 parent 9b4bccc commit 67c1904
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,10 @@ class UnitAclController(
) {
db.transaction { tx ->
if (
!tx.hasRoleInAnyUnitWithProviderType(
!tx.hasRoleInAnyUnitWithProviderTypes(
job.employeeId,
UserRole.UNIT_SUPERVISOR,
ProviderType.MUNICIPAL,
setOf(ProviderType.MUNICIPAL, ProviderType.MUNICIPAL_SCHOOL),
)
) {
tx.deletePersonalDevices(job.employeeId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ fun Database.Read.hasAnyDaycareAclRow(employeeId: EmployeeId): Boolean =
}
.exactlyOne<Boolean>()

fun Database.Read.hasRoleInAnyUnitWithProviderType(
fun Database.Read.hasRoleInAnyUnitWithProviderTypes(
employeeId: EmployeeId,
role: UserRole,
providerType: ProviderType,
providerTypes: Set<ProviderType>,
): Boolean =
createQuery {
sql(
Expand All @@ -88,7 +88,7 @@ SELECT EXISTS (
WHERE
acl.employee_id = ${bind(employeeId)} AND
acl.role = ${bind(role)} AND
d.provider_type = ${bind(providerType)}
d.provider_type = ANY (${bind(providerTypes)})
)
"""
)
Expand Down

0 comments on commit 67c1904

Please sign in to comment.