TRUNK-6203: Global properties access should be privileged#43
Merged
Conversation
wikumChamith
force-pushed
the
TRUNK-6203
branch
2 times, most recently
from
July 30, 2024 07:06
24fc2d6 to
c339410
Compare
dkayiwa
reviewed
Jul 30, 2024
| Context.removeProxyPrivilege("Get Global Properties"); | ||
| } | ||
|
|
||
| if (globalProperty.equalsIgnoreCase("true")) { |
Member
There was a problem hiding this comment.
What if globalProperty is returned as null?
dkayiwa
reviewed
Jul 30, 2024
| if (Context.getAdministrationService().getGlobalProperty(AddressHierarchyConstants.GLOBAL_PROP_INITIALIZE_ADDRESS_HIERARCHY_CACHE_ON_STARTUP).equalsIgnoreCase("true")) { | ||
| String globalProperty = ""; | ||
| try { | ||
| Context.addProxyPrivilege("Get Global Properties"); |
Member
There was a problem hiding this comment.
Don't we have a constant for the privilege?
Member
Author
There was a problem hiding this comment.
We'll have to update the platform version. However, it is giving me a lot of errors.
Member
There was a problem hiding this comment.
Which version did you upgrade it to? Can i look at the errors?
Member
There was a problem hiding this comment.
Thinking about this again, it does not look good to do this from here because this can be called from different contexts. Can we do it from where the call originates?
Member
Author
There was a problem hiding this comment.
I tried updating the platform version to 1.11.6. I am seeing multiple test errors similar to this:
[ERROR] getChildAddressHierarchyEntries_shouldGetChildAddressHierarchyEntries(org.openmrs.module.addresshierarchy.AddressHierarchyServiceTest) Time elapsed: 0.164 s <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [/home/wikum/Documents/Code/OpenMRS/openmrs-module-addresshierarchy/api/target/classes/org/openmrs/module/addresshierarchy/i18n/DisabledI18nCache.class]; nested exception is java.lang.ArrayIndexOutOfBoundsException: 1
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of what I changed
After openmrs/openmrs-core#4601, users must possess the 'Get Global Properties' privilege to access global properties. This grants it as a proxy privilege so users can access essential pages, such as the login page.
Issue I worked on
see https://openmrs.atlassian.net/browse/TRUNK-6203
Checklist: I completed these to help reviewers :)
My IDE is configured to follow the code style of this project.
No? Unsure? -> configure your IDE, format the code and add the changes with
git add . && git commit --amend[] I have added tests to cover my changes. (If you refactored
existing code that was well tested you do not have to add tests)
No? -> write tests and add them to this commit
git add . && git commit --amendI ran
mvn clean packageright before creating this pull request andadded all formatting changes to my commit.
No? -> execute above command
All new and existing tests passed.
No? -> figure out why and add the fix to your commit. It is your responsibility to make sure your code works.
My pull request is based on the latest changes of the master branch.
No? Unsure? -> execute command
git pull --rebase upstream master