Skip to content

Commit

Permalink
Merge pull request #115 from RADAR-base/refactor/more-efficient-caching
Browse files Browse the repository at this point in the history
Improve caching efficiency for authorization requests
  • Loading branch information
pvannierop authored Nov 15, 2024
2 parents f736570 + 3e67ea6 commit 2663657
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@Suppress("ConstPropertyName")
object Versions {
const val project = "0.7.5"
const val project = "0.7.6"

const val java = 17
const val kotlin = "1.9.22"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ class AvroRecordProcessor(

for (entity in this) {
// Make sure to perform the permission check on entities only once.
// Note:
if (entitiesChecked.contains(entity)) continue

// There is a 'feature' around the comparison of EntityDetails objects; the checkPermissions method
// updates the EntityDetails object with the organization id. This means that for effective comparison
// we have to make copy of entity details so that the original entity details are compared. Without
// this every entity processed here would be considered as an entity different from all previous and
// would trigger a new permission check. This situation is a consequence of the later addition of the
// concept of organization to the entity details.
val entityCheck = entity.copy()
if (!entitiesChecked.add(entityCheck)) continue
entitiesChecked.add(entity.copy())

authService.checkPermission(
Permission.MEASUREMENT_CREATE,
Expand Down

0 comments on commit 2663657

Please sign in to comment.