-
Notifications
You must be signed in to change notification settings - Fork 169
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
Add endpoint to clear the cdm_cache and achilles_cache #2406
Add endpoint to clear the cdm_cache and achilles_cache #2406
Conversation
Hi @amarsan . Excellent work, and I appreciate you following the existing patterns in the codebase (such as creating jobs and tasklets) to perform this activity in background. Some comments:
Great work, tho, it was a lot of effort to follow the patterns in code, so that was a good effort. I think in this case we just don't need to disable the ability to clear a cache nor make the clear action async. As far as writing a test case where you want to test a person is admin, I think I have a unit test for wildcard permissions that I had to 'inject' a user context into the test case that had the necessary permissions that I was testing...I think you can do the same thing by injecting a user context that has the admin role. Let me dig it up and i'll reference it here when I find it. |
.editorconfig
Outdated
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we're doing this let's do 2 space indent.
Would the tests that we used to test wildcard permissions serve as a good model for doing your own permission test: I believe you would just set up a JSON file to insert records into user-role to assign the user to the admin role. |
@chrisknoll this is ready for review now. This PR has been a crash course for me in Spring Boot, Shiro, and async in Java. Some issues I ran into:
|
SELECT sr.id, sp.id | ||
FROM ${ohdsiSchema}.sec_permission sp, | ||
${ohdsiSchema}.sec_role sr | ||
WHERE sp."value" in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't use quoted identifiers here, it will make the column case sensitive. We don't want that.
Ok, this works, but I would like that migration changed to drop the quoted identifiers around "value". Otherwise, works well, with warm cache disabled, it still removes the cached values that get loaded from the next lookup request. |
Ok, due to short week and we want to keep this moving, I'll merge it in and we can address quoted identifiers in a patch later if necessary. Migration seems to work on postgres, but let's keep away from quoted identifiers in the future. |
supports OHDSI/Atlas#2847
This adds an endpoint to clear the cdm_cache and achilles_cache tables for sources that the caller has access to. The caller must be an admin.
I followed the pattern for warming a cache, wrapping the operation in a Job.
I wanted to write an integration test for this, but ran into the issue that since the user needs to be an admin, security roles and users need to be set up as part of the integration tests. I haven't tackled figuring that out yet. Guidance here would be much appreciated.