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

Support login for multiple users #2779

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft

Support login for multiple users #2779

wants to merge 22 commits into from

Conversation

LZRS
Copy link
Contributor

@LZRS LZRS commented Sep 22, 2023

IMPORTANT: Where possible all PRs must be linked to a Github issue

Fixes #2330

Engineer Checklist

  • I have written Unit tests for any new feature(s) and edge cases for bug fixes
  • I have added any strings visible on UI components to the strings.xml file
  • I have updated the CHANGELOG.md file for any notable changes to the codebase
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the project's style guide
  • I have built and run the FHIRCore app to verify my change fixes the issue and/or does not break the app
  • I have checked that this PR does NOT introduce breaking changes that require an update to Content and/or Configs? If it does add a sample here or a link to exactly what changes need to be made to the content.

Code Reviewer Checklist

  • I have verified Unit tests have been written for any new feature(s) and edge cases
  • I have verified any strings visible on UI components are in the strings.xml file
  • I have verifed the CHANGELOG.md file has any notable changes to the codebase
  • I have verified the solution has been implemented in a configurable and generic way for reuseable components
  • I have built and run the FHIRCore app to verify the change fixes the issue and/or does not break the app

@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Attention: Patch coverage is 70.83333% with 28 lines in your changes missing coverage. Please review.

Project coverage is 64.8%. Comparing base (ac82739) to head (bfc4596).
Report is 89 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##              main   #2779      +/-   ##
==========================================
+ Coverage     29.6%   64.8%   +35.1%     
- Complexity     658     998     +340     
==========================================
  Files          239     233       -6     
  Lines        11204    9431    -1773     
  Branches      1948    1713     -235     
==========================================
+ Hits          3323    6116    +2793     
+ Misses        7447    2232    -5215     
- Partials       434    1083     +649     
Flag Coverage Δ
geowidget 18.7% <ø> (-28.5%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...gister/fhircore/engine/rulesengine/RulesFactory.kt 66.4% <ø> (-3.0%) ⬇️
...ter/fhircore/engine/util/SecureSharedPreference.kt 97.0% <ø> (+2.7%) ⬆️
...gister/fhircore/engine/util/SharedPreferenceKey.kt 100.0% <ø> (ø)
...egister/fhircore/quest/ui/login/LoginErrorState.kt 100.0% <100.0%> (ø)
...artregister/fhircore/quest/ui/login/LoginScreen.kt 67.7% <100.0%> (+67.7%) ⬆️
...egister/fhircore/quest/ui/main/AppMainViewModel.kt 82.5% <ø> (+78.0%) ⬆️
...rtregister/fhircore/quest/ui/pin/PinLoginScreen.kt 65.6% <ø> (+65.6%) ⬆️
.../smartregister/fhircore/quest/ui/pin/PinUiState.kt 100.0% <ø> (ø)
...martregister/fhircore/quest/ui/pin/PinViewModel.kt 89.2% <ø> (+82.6%) ⬆️
...e/quest/ui/questionnaire/QuestionnaireViewModel.kt 72.1% <ø> (+68.5%) ⬆️
... and 3 more

... and 122 files with indirect coverage changes

@@ -29,7 +29,7 @@ data class ApplicationConfiguration(
val languages: List<String> = listOf("en"),
val useDarkTheme: Boolean = false,
val syncInterval: Long = 15,
val syncStrategies: List<String> = listOf(),
val syncStrategy: List<String> = listOf(),
Copy link
Member

Choose a reason for hiding this comment

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

since this is a list I think as is as a plural makes sense

Comment on lines 100 to 102
if (value is PractitionerDetails) {
Timber.e(it)
}
Copy link
Member

Choose a reason for hiding this comment

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

guessing this is temporary for debugging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it's just for debugging

@ellykits ellykits added Discussion This is an open discussion that may or may not lead to actionable points Work In Progress Describes an items that is not complete. Mostly used for scoping issues of discussions labels Oct 11, 2023
@pld
Copy link
Member

pld commented Oct 27, 2023

@LZRS is this ready for review?

@LZRS
Copy link
Contributor Author

LZRS commented Oct 27, 2023

@LZRS is this ready for review?

It can be reviewed but there are still some code changes pending, as we look to consult further (with tpms) on how/what user roles to check for and also update tests

@LZRS
Copy link
Contributor Author

LZRS commented Nov 24, 2023

Currently, only supporting multiple user logins when online. Will be adding support for offline as well in subsequent sessions, as we continue to discuss on how to effectively handle the pin login usecase

@LZRS
Copy link
Contributor Author

LZRS commented Apr 19, 2024

@ndegwamartin
Copy link
Contributor

I think we can skip this UI/UX given that after one logs in using username and password we already know who the user is. The workflow for switching users should be like Logout -> Login in (for other user) -> Enter pin for username . We can infer the username from the previous (login) step.

@LZRS LZRS force-pushed the support-multi-user-login branch from 36b810f to faebd25 Compare May 17, 2024 13:03
@LZRS
Copy link
Contributor Author

LZRS commented May 17, 2024

I think we can skip this UI/UX given that after one logs in using username and password we already know who the user is. The workflow for switching users should be like Logout -> Login in (for other user) -> Enter pin for username . We can infer the username from the previous (login) step.

@ndegwamartin This would mean that users wouldn't be able to change their pin once setup, right?
The user dropdown was intended to enable switching accounts using the pin login page without having to go to the username login page(and having to re-enter their password)

@ndegwamartin
Copy link
Contributor

I think we can skip this UI/UX given that after one logs in using username and password we already know who the user is. The workflow for switching users should be like Logout -> Login in (for other user) -> Enter pin for username . We can infer the username from the previous (login) step.

@ndegwamartin This would mean that users wouldn't be able to change their pin once setup, right? The user dropdown was intended to enable switching accounts using the pin login page without having to go to the username login page(and having to re-enter their password)

@LZRS I get it now, if that's the use case then yeah lets implement it like it is in the new design cc @Rkareko

@LZRS LZRS force-pushed the support-multi-user-login branch from 8e67b8c to a029ab6 Compare June 14, 2024 12:55
@pld
Copy link
Member

pld commented Jun 14, 2024

@LZRS this ready for review?

@LZRS
Copy link
Contributor Author

LZRS commented Jun 14, 2024

@LZRS this ready for review?

Yeah, it's ready for an initial review although we're still deliberating on how to go about pin login. For the suggested workflows of logging out and logging in to change user, and allowing selection of user from dropdown from pin login page, we're still not certain how to handle/support a user resetting their pin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion This is an open discussion that may or may not lead to actionable points Work In Progress Describes an items that is not complete. Mostly used for scoping issues of discussions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support logging in multiple users (of the same team) when online
6 participants