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

RA-1503 Added implementation to store the session location in userContext #19

Merged
merged 1 commit into from Jun 28, 2018

Conversation

@suthagar23
Copy link
Member

suthagar23 commented Jun 10, 2018

Description

Logged-in user session information can be fetched only from the web layer. If we want to get the currently logged-in user location information, then we need to call a given REST API .

This implementation will keep the logged-in user session location information into the UserContext to extend the API level usage.

Ticket Information

Ticket : https://issues.openmrs.org/browse/RA-1503

@suthagar23 suthagar23 force-pushed the suthagar23:RA-1503 branch from 8652a2d to 23c3bc7 Jun 12, 2018
@@ -82,6 +83,13 @@ public void setSessionLocation(Location sessionLocation) {
}
this.sessionLocation = sessionLocation;
this.sessionLocationId = sessionLocation.getId();
setSessionLocationInUserContext(sessionLocation);

This comment has been minimized.

@dkayiwa

dkayiwa Jun 12, 2018 Member

Do you have to set it again here after the above?

This comment has been minimized.

@suthagar23

suthagar23 Jun 12, 2018 Author Member

I thought, it would be clean to have it while making initialization

This comment has been minimized.

@dkayiwa

dkayiwa Jun 12, 2018 Member

My point is, do you need to do it twice?

This comment has been minimized.

@suthagar23

suthagar23 Jun 19, 2018 Author Member

Yah, No need it twice, I have removed it from here.

@suthagar23 suthagar23 force-pushed the suthagar23:RA-1503 branch from 23c3bc7 to d93dc2f Jun 19, 2018
@dkayiwa
Copy link
Member

dkayiwa commented Jun 19, 2018

Can you look at the above travis failure?

@dkayiwa
Copy link
Member

dkayiwa commented Jun 20, 2018

@suthagar23 did you see the above comment?

@dkayiwa
Copy link
Member

dkayiwa commented Jun 26, 2018

@suthagar23 did you see these comments?

@suthagar23
Copy link
Member Author

suthagar23 commented Jun 27, 2018

Ohh Sorry, I will fix it soon

@suthagar23 suthagar23 force-pushed the suthagar23:RA-1503 branch from d93dc2f to 2fcc3e2 Jun 28, 2018
@suthagar23
Copy link
Member Author

suthagar23 commented Jun 28, 2018

@dkayiwa I have fixed it. Please have a look again.

this.setSessionLocationToUserContext(sessionLocation);
}

private void setSessionLocationToUserContext(Location location) {

This comment has been minimized.

@dkayiwa

dkayiwa Jun 28, 2018 Member

Why do you create a method that you only use once, for a mere two lines?

This comment has been minimized.

@suthagar23

suthagar23 Jun 28, 2018 Author Member

Actually I used it two time before. No need for now.
Just removed

@suthagar23 suthagar23 force-pushed the suthagar23:RA-1503 branch from 2fcc3e2 to 18238e8 Jun 28, 2018
@@ -82,6 +82,9 @@ public void setSessionLocation(Location sessionLocation) {
}
this.sessionLocation = sessionLocation;
this.sessionLocationId = sessionLocation.getId();
if (userContext != null && userContext.getAuthenticatedUser() != null) {
userContext.setLocationId(sessionLocation.getLocationId());

This comment has been minimized.

@dkayiwa

dkayiwa Jun 28, 2018 Member

Why do you call getLocationId? Don't you already have the id?

This comment has been minimized.

@suthagar23

suthagar23 Jun 28, 2018 Author Member

I forgot that one and just replaced by mistake. I have fixed it by now.

Added minor changes for testing

Minor modifications

Minor fix

Removed function and merged with existing function

Minor fix
@suthagar23 suthagar23 force-pushed the suthagar23:RA-1503 branch from 18238e8 to d674009 Jun 28, 2018
@suthagar23 suthagar23 changed the title Added implementation to store the session location in userContext RA-1503 Added implementation to store the session location in userContext Jun 28, 2018
@@ -82,6 +82,9 @@ public void setSessionLocation(Location sessionLocation) {
}
this.sessionLocation = sessionLocation;
this.sessionLocationId = sessionLocation.getId();
if (userContext != null && userContext.getAuthenticatedUser() != null) {

This comment has been minimized.

@dkayiwa

dkayiwa Jun 28, 2018 Member

Does this also cater for the case where i just switch location when am already logged in?

This comment has been minimized.

@suthagar23

suthagar23 Jun 28, 2018 Author Member

Yes, It will immediately swtich the location when you already logged in.

@dkayiwa dkayiwa merged commit 992b9ad into openmrs:master Jun 28, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.