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

[PP-1650] Allows SirsiDynix Horizon Auth Provider users to reset Adob… #2026

Merged
merged 4 commits into from
Sep 6, 2024

Conversation

dbernstein
Copy link
Contributor

@dbernstein dbernstein commented Sep 3, 2024

…e IDs.

Description

This update brings SirsiDynix Horizon Auth Provider in line with other Auth Providers which do not require users to authenticate before resetting their Adobe IDs.

When a CM admin tries to reset a patron's the Adobe ID, the CM makes an attempt to verify that the patron exists. For SIP2 and Millenium Providers, this kind of unauthenticated query is supported For Kansas, it is not supported so the KansasAuthenticationAPI just quietly passes the patron object back to the caller. However for SirsiDynix Horizon an authenticated session is required to pull patron information.

This update therefore allows a Sirsidynix Auth Provider caller to return an incomplete PatronData object rather than no result at all. In this way, CM admins will be able to reset adobe ids for sirsidynix-using library patrons without needing the patrons credentials.

I moved this PR out of draft mode because I haven't yet heard back from SirsiDynix and I'm not holding my breath. I doubt that their API supports what we ideally want to be able to do here: namely, to retrieve some minimal user info without having to authenticate. If it turns out that we can, I can always put in a new PR to take advantage of pulling patron info without authenticating.

Motivation and Context

https://ebce-lyrasis.atlassian.net/browse/PP-1630

How Has This Been Tested?

Tests have been updated and coverage improved.

Checklist

  • I have updated the documentation accordingly.
  • All new and existing tests passed.

@dbernstein dbernstein marked this pull request as draft September 3, 2024 22:56
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 90.76%. Comparing base (69f6e3e) to head (a2ccc5b).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/palace/manager/api/admin/controller/patron.py 80.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2026   +/-   ##
=======================================
  Coverage   90.76%   90.76%           
=======================================
  Files         342      342           
  Lines       40512    40514    +2     
  Branches     8770     8770           
=======================================
+ Hits        36769    36773    +4     
+ Misses       2486     2485    -1     
+ Partials     1257     1256    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dbernstein dbernstein marked this pull request as ready for review September 4, 2024 17:55
@dbernstein dbernstein force-pushed the PP-1630 branch 2 times, most recently from cc8f246 to 2d99505 Compare September 5, 2024 19:27
Copy link
Member

@jonathangreen jonathangreen left a comment

Choose a reason for hiding this comment

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

Looks good.

I made some minor comments about type checking that would be nice to fix up before this one gets merged though.

@@ -194,22 +193,30 @@ def remote_authenticate(

def remote_patron_lookup(
self, patron_or_patrondata: Patron | PatronData
) -> None | SirsiDynixPatronData:
) -> None | SirsiDynixPatronData | PatronData:
Copy link
Member

Choose a reason for hiding this comment

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

Since SirsiDynixPatronData is a PatronData this can be simplified to None | PatronData

if (
not hasattr(patron_or_patrondata, "session_token")
or patron_or_patrondata.session_token is None
):
Copy link
Member

Choose a reason for hiding this comment

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

You can eliminate all the # type: ignore comments below by updating this to be:

  if (
      not isinstance(patron_or_patrondata, SirsiDynixPatronData)
      or patron_or_patrondata.session_token is None
  ):
      patron_or_patrondata.complete = False
      return patron_or_patrondata

* Remove commented code
* Add a test to cover case when remote_patron_lookup is called with Patron parameter.
@dbernstein dbernstein merged commit 81b7ce9 into main Sep 6, 2024
19 of 20 checks passed
@dbernstein dbernstein deleted the PP-1630 branch September 6, 2024 19:52
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