Skip to content

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

Open
Seremba wants to merge 1 commit into
openmrs:masterfrom
Seremba:ADDR-132
Open

ADDR-132: Add 'Get Global Properties' proxy privilege#41
Seremba wants to merge 1 commit into
openmrs:masterfrom
Seremba:ADDR-132

Conversation

@Seremba

@Seremba Seremba commented Feb 29, 2024

Copy link
Copy Markdown

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

dkayiwa commented Feb 29, 2024

Copy link
Copy Markdown
Member

Can you look into the above failure on Java 17?

@Seremba

Seremba commented Mar 1, 2024

Copy link
Copy Markdown
Author

Hi @dkayiwa, I am done!

@dkayiwa

dkayiwa commented Mar 1, 2024

Copy link
Copy Markdown
Member

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

Seremba commented Mar 3, 2024

Copy link
Copy Markdown
Author

Hello @dkayiwa , how about now?

@Seremba

Seremba commented Mar 3, 2024

Copy link
Copy Markdown
Author

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

@Seremba

Seremba commented Mar 3, 2024

Copy link
Copy Markdown
Author

Hi @dkayiwa

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

Seremba commented Mar 5, 2024

Copy link
Copy Markdown
Author

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

dkayiwa commented Mar 5, 2024

Copy link
Copy Markdown
Member

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

Seremba commented Mar 5, 2024

Copy link
Copy Markdown
Author

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

@dkayiwa

dkayiwa commented Mar 5, 2024

Copy link
Copy Markdown
Member

What do you suggest I should do?

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

@Seremba

Seremba commented Mar 5, 2024

Copy link
Copy Markdown
Author

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

dkayiwa commented Mar 5, 2024

Copy link
Copy Markdown
Member

I still see more changes than i would expect.

@Seremba

Seremba commented Mar 5, 2024

Copy link
Copy Markdown
Author

I am done @dkayiwa

@dkayiwa

dkayiwa commented Mar 5, 2024

Copy link
Copy Markdown
Member

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

@Seremba

Seremba commented Mar 5, 2024

Copy link
Copy Markdown
Author

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

dkayiwa commented Mar 5, 2024

Copy link
Copy Markdown
Member

@Seremba

Seremba commented Mar 5, 2024

Copy link
Copy Markdown
Author

Hi @dkayiwa, I am done.

if ((this.fullAddressCacheInitialized == false || MapUtils.isEmpty(this.fullAddressCache))
&& this.getAddressHierarchyEntryCount() > 0) {

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

Copy link
Copy Markdown
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
Copy Markdown
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

Seremba commented Mar 5, 2024

Copy link
Copy Markdown
Author

Hi @dkayiwa I am done reverting the formatting changes

@dkayiwa

dkayiwa commented Mar 5, 2024

Copy link
Copy Markdown
Member

Do we need to remove the proxy privilege?

@Seremba

Seremba commented Mar 5, 2024

Copy link
Copy Markdown
Author

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

Seremba commented Mar 6, 2024

Copy link
Copy Markdown
Author

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

Seremba commented Mar 7, 2024

Copy link
Copy Markdown
Author

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

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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

dkayiwa commented Mar 7, 2024

Copy link
Copy Markdown
Member

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

@Seremba

Seremba commented Mar 7, 2024

Copy link
Copy Markdown
Author

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

dkayiwa commented Mar 7, 2024

Copy link
Copy Markdown
Member

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

@Seremba

Seremba commented Mar 7, 2024

Copy link
Copy Markdown
Author

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

@dkayiwa

dkayiwa commented Mar 7, 2024

Copy link
Copy Markdown
Member

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

@Seremba

Seremba commented Mar 7, 2024

Copy link
Copy Markdown
Author

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

dkayiwa commented Mar 7, 2024

Copy link
Copy Markdown
Member

How many reference application modules do you have loaded?

@Seremba

Seremba commented Mar 7, 2024

Copy link
Copy Markdown
Author

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

dkayiwa commented Mar 7, 2024

Copy link
Copy Markdown
Member

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

Seremba commented Mar 7, 2024

Copy link
Copy Markdown
Author

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