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

ADDR-132: Add 'Get Global Properties' proxy privilege #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Seremba
Copy link

@Seremba Seremba commented Feb 29, 2024

Description of what I changed

Issue I worked on

see https://openmrs.atlassian.net/browse/ADDR-132

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 --amend

  • I ran mvn clean package right before creating this pull request and
    added 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

@dkayiwa
Copy link
Member

dkayiwa commented Feb 29, 2024

Can you look into the above failure on Java 17?

@Seremba
Copy link
Author

Seremba commented Mar 1, 2024

Hi @dkayiwa, I am done!

@dkayiwa
Copy link
Member

dkayiwa commented Mar 1, 2024

It has failed again.

@Seremba Seremba force-pushed the ADDR-132 branch 2 times, most recently from e4a43fd to 6ebfe8e Compare March 3, 2024 00:40
@Seremba
Copy link
Author

Seremba commented Mar 3, 2024

Hello @dkayiwa , how about now?

@Seremba
Copy link
Author

Seremba commented Mar 3, 2024

Hi @dkayiwa I am done making changes to this. Kindly review!

@Seremba
Copy link
Author

Seremba commented Mar 3, 2024

Hi @dkayiwa

@Seremba Seremba marked this pull request as draft March 4, 2024 13:35
@Seremba
Copy link
Author

Seremba commented Mar 5, 2024

Hi @dkayiwa, I set this to draft until the tests pass. However, currently, OpenMRS does not support Java 17. Don't you think it is the cause for failures until maybe OpenMRS officially supports Java 17? What do you have to say?

@dkayiwa
Copy link
Member

dkayiwa commented Mar 5, 2024

Don't you think it is the cause for failures until maybe OpenMRS officially supports Java 17? What do you have to say?

You are correct!

@Seremba
Copy link
Author

Seremba commented Mar 5, 2024

Thanks for the response @dkayiwa. What do you suggest I should do?

@dkayiwa
Copy link
Member

dkayiwa commented Mar 5, 2024

What do you suggest I should do?

Let us start by removing all the changes we had added for Java 17

@Seremba
Copy link
Author

Seremba commented Mar 5, 2024

What do you suggest I should do?

Let us start by removing all the changes we had added for Java 17

Hi @dkayiwa, I am done already

@Seremba Seremba marked this pull request as ready for review March 5, 2024 12:28
@dkayiwa
Copy link
Member

dkayiwa commented Mar 5, 2024

I still see more changes than i would expect.

@Seremba
Copy link
Author

Seremba commented Mar 5, 2024

I am done @dkayiwa

@dkayiwa
Copy link
Member

dkayiwa commented Mar 5, 2024

Your pull request still has very many changes not related to the Get Global Properties privilege.

@Seremba
Copy link
Author

Seremba commented Mar 5, 2024

Mr @dkayiwa, Is getting back to this commit ca8ffc2 and discarding the rest recommended? because originally, it was the only one meant for Get Global Properties privileges

@dkayiwa
Copy link
Member

dkayiwa commented Mar 5, 2024

@Seremba
Copy link
Author

Seremba commented Mar 5, 2024

Hi @dkayiwa, I am done.

// only initialize if necessary (and if we have entries)
if ((this.fullAddressCacheInitialized == false || MapUtils.isEmpty(this.fullAddressCache))
&& this.getAddressHierarchyEntryCount() > 0) {

this.fullAddressCache = new HashMap<Locale, Map<String,List<String>> >();
Copy link
Member

Choose a reason for hiding this comment

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

Can we revert the formatting changes?

Copy link
Author

Choose a reason for hiding this comment

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

Okay. let me do that

@Seremba
Copy link
Author

Seremba commented Mar 5, 2024

Hi @dkayiwa I am done reverting the formatting changes

@dkayiwa
Copy link
Member

dkayiwa commented Mar 5, 2024

Do we need to remove the proxy privilege?

@Seremba
Copy link
Author

Seremba commented Mar 5, 2024

You mean with the try-finally block? I got an error with that and the problem did not get away. But let me try again

@Seremba
Copy link
Author

Seremba commented Mar 6, 2024

Do we need to remove the proxy privilege?

Hi @dkayiwa, I added and removed the proxy privilege with a try-finally block; compiled and started the reference application, and reloaded the address hierarchy module. Stopped the server, and ran the reference application again. Then left the program running throughout the night so I confirm whether org.openmrs.api.APIAuthenticationException: Privileges required: Get Global Properties error appears. Fortunately, it did not. So I had to commit and push the changes.

@Seremba
Copy link
Author

Seremba commented Mar 7, 2024

Hi @dkayiwa , is there anything you require I do on this?

getAddressesForLocale(locale);
this.fullAddressCacheInitialized = true;
try {
Context.addProxyPrivilege("Get Global Properties");
Copy link
Member

Choose a reason for hiding this comment

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

I would use a locally declared constant for the above string.

Copy link
Author

Choose a reason for hiding this comment

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

fine. Let me do that!

Copy link
Author

Choose a reason for hiding this comment

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

I would use a locally declared constant for the above string.

Hi @dkayiwa, I am done with this!

@dkayiwa
Copy link
Member

dkayiwa commented Mar 7, 2024

Are you now able to run this module without errors in your modified openmrs-core?

@Seremba
Copy link
Author

Seremba commented Mar 7, 2024

Are you now able to run this module without errors in your modified openmrs-core?

Yes. I can run the address hierarchy module without any errors.

@dkayiwa
Copy link
Member

dkayiwa commented Mar 7, 2024

Is it the only module that you have loaded? Or do you even have the rest of the reference application modules?

@Seremba
Copy link
Author

Seremba commented Mar 7, 2024

You mean loading and unloading the rest of the reference application modules?

@dkayiwa
Copy link
Member

dkayiwa commented Mar 7, 2024

I mean being able to run all the reference application modules with your changes in openmrs-core

@Seremba
Copy link
Author

Seremba commented Mar 7, 2024

I mean being able to run all the reference application modules with your changes in openmrs-core

They also run well. I get no problem whatsoever with any reference application module.

@dkayiwa
Copy link
Member

dkayiwa commented Mar 7, 2024

How many reference application modules do you have loaded?

@Seremba
Copy link
Author

Seremba commented Mar 7, 2024

I have about 42 modules in the reference application cc @dkayiwa
Screenshot 2024-03-07 173511
Screenshot 2024-03-07 173530
Screenshot 2024-03-07 173552

@dkayiwa
Copy link
Member

dkayiwa commented Mar 7, 2024

So if those are successfully running and you have done all the required changes in openmrs-core as specified in that ticket, then you can ask for code review as advised here: https://openmrs.atlassian.net/wiki/spaces/docs/pages/25477199/Pull+Request+Tips

@Seremba
Copy link
Author

Seremba commented Mar 7, 2024

Thank you so much! Let me do that.

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.

2 participants