Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Apply correct DAOP after changing them (remove its caching) (DEV-1965) #2551

Merged
merged 11 commits into from
Mar 28, 2023

Conversation

seakayone
Copy link
Contributor

@seakayone seakayone commented Mar 27, 2023

Pull Request Checklist

Task Description/Number

Issue Number: DEV-1965

Fix caching problem by removing the caching for all permissions including DAOP (default access object permissions).

When a resource is created, the permissions are added based on the default object access permissions. This information is read from cache.

When updating a default object access permission's knora-base:hasPermission through the API (https://docs.dasch.swiss/2023.03.01/DSP-API/03-endpoints/api-admin/permissions/#updating-a-permissions-scope), this updates the DB but doesn't invalidate the cache.

As a result, after updating the default object access permission, the stack has to be restarted, otherwise the old permissions will be used.

Basic Requirements

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • fix: represents bug fixes
  • refactor: represents production code refactoring
  • feat: represents a new feature
  • docs: documentation changes (no production code change)
  • chore: maintenance tasks (no production code change)
  • test: all about tests: adding, refactoring tests (no production code change)
  • other... Please describe:

Does this PR introduce a breaking change?

  • Yes
  • No
  • Maybe (not 100% sure => check with FE)

Does this PR change client-test-data?

  • Yes (don't forget to update the JS-LIB team about the change)
  • No

@linear
Copy link

linear bot commented Mar 27, 2023

DEV-1965 Updating Default Object Access Permissions doesn't invalidate cache.

When a resource is created, the permissions are added based on the default object access permissions. This information is read from cache.

When updating a default object access permission's knora-base:hasPermission through the API (https://docs.dasch.swiss/2023.03.01/DSP-API/03-endpoints/api-admin/permissions/#updating-a-permissions-scope), this updates the DB but doesn't invalidate the cache.

As a result, after updating the default object access permission, the stack has to be restarted, otherwise the old permissions will be used.

@seakayone seakayone self-assigned this Mar 27, 2023
@seakayone seakayone changed the title Bugfix/default object access permissions dev 1965 Bugfix/default object access permissions DEV-1965 Mar 27, 2023
@seakayone seakayone changed the title Bugfix/default object access permissions DEV-1965 fix: default object access permissions DEV-1965 Mar 27, 2023
@seakayone seakayone force-pushed the bugfix/default-object-access-permissions-DEV-1965 branch from bd25f12 to 73eb4be Compare March 27, 2023 11:21
@codecov
Copy link

codecov bot commented Mar 27, 2023

Codecov Report

Patch coverage: 88.46% and project coverage change: -68.78 ⚠️

Comparison is base (00b7070) 86.53% compared to head (ff56abd) 17.75%.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2551       +/-   ##
===========================================
- Coverage   86.53%   17.75%   -68.78%     
===========================================
  Files         262      262               
  Lines       28889    28871       -18     
===========================================
- Hits        25000     5127    -19873     
- Misses       3889    23744    +19855     
Impacted Files Coverage Δ
...r/permissionsmessages/PermissionsMessagesADM.scala 26.36% <ø> (-60.35%) ⬇️
...rmissionsmessages/PermissionsMessagesUtilADM.scala 73.80% <ø> (-20.31%) ⬇️
...api/responders/admin/PermissionsResponderADM.scala 30.86% <88.00%> (-60.75%) ⬇️
...api/store/triplestore/api/TriplestoreService.scala 80.00% <100.00%> (-20.00%) ⬇️

... and 185 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@seakayone seakayone force-pushed the bugfix/default-object-access-permissions-DEV-1965 branch from 73eb4be to 3ab321c Compare March 27, 2023 11:40
@seakayone seakayone force-pushed the bugfix/default-object-access-permissions-DEV-1965 branch from fb2e1d5 to 54d4e51 Compare March 27, 2023 12:13
@seakayone seakayone requested review from BalduinLandolt, mpro7 and irinaschubert and removed request for BalduinLandolt March 27, 2023 14:51
@seakayone seakayone marked this pull request as ready for review March 27, 2023 14:51
Copy link
Contributor

@BalduinLandolt BalduinLandolt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One cache down... Huzza!

Copy link

@irinaschubert irinaschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I would change the title to something like "remove caching for default object access permissions", but I leave this up to you.

Copy link

@irinaschubert irinaschubert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It just came to my mind that the permissions cache could now maybe be removed from the API alltogether - or are there more usages of it? I refer to this location in the application.conf:

cache-name = "permissionsCache"

@seakayone
Copy link
Contributor Author

It just came to my mind that the permissions cache could now maybe be removed from the API alltogether - or are there more usages of it? I refer to this location in the application.conf:

cache-name = "permissionsCache"

Thanks for the hint, I have removed it also from the conf file.

After that there are no more occurences of the String permissionsCache in the code.

@seakayone seakayone changed the title fix: default object access permissions DEV-1965 fix: Apply correct DAOP after changeing them (remove its caching) DEV-1965 Mar 27, 2023
@seakayone seakayone enabled auto-merge (squash) March 27, 2023 15:30
@mpro7 mpro7 changed the title fix: Apply correct DAOP after changeing them (remove its caching) DEV-1965 fix: Apply correct DAOP after changing them (remove its caching) (DEV-1965) Mar 28, 2023
@seakayone seakayone merged commit 72e5f92 into main Mar 28, 2023
@seakayone seakayone deleted the bugfix/default-object-access-permissions-DEV-1965 branch March 28, 2023 07:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants