Bug 36941 - Highlight that some libraries should not be available at login when StaffLoginRestrictBranchByIP is enabled
Summary: Highlight that some libraries should not be available at login when StaffLogi...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-23 10:14 UTC by Martin Renvoize (ashimema)
Modified: 2024-11-18 16:54 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement changes the staff interface login form so that only valid libraries are shown in the dropdown list when the `StaffLoginRestrictBranchByIP` preference is enabled.
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 36941: Limit login branch list when IP restriction enabled (6.51 KB, patch)
2024-05-23 12:35 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 36941: Limit login branch list when IP restriction enabled (6.55 KB, patch)
2024-05-28 00:34 UTC, David Nind
Details | Diff | Splinter Review
Bug 36941: Limit login branch list when IP restriction enabled (8.38 KB, patch)
2024-06-27 12:58 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2024-05-23 10:14:22 UTC
Currently, we appear to still list all libraries in the dropdown when the `StaffLoginRestrictBranchByIP` preference is enabled.. this is unclear to the end user.

We should be able to distinguish the IP range before loading the login page and thus only display valid options in the list (or at least display the invalid options as disabled)

Question however.. how should this work for a librarian with increased privileges.. perhaps we should hint they're unavailable but not actually disable their selection for this use case?
Comment 1 Nick Clemens (kidclamp) 2024-05-23 12:35:07 UTC
Created attachment 167108 [details] [review]
Bug 36941: Limit login branch list when IP restriction enabled

This patch adds a new 'ip_limit' option to Koha::Template:Plugin::Branches

To test:
1 - Set some branches in the system to have random IPs
2 - Set one branch to have your IP
    To find the IP in KTD I:
    Enabled ILS-DI
    Set ILS-DI:AuthorizedIPs to 1.1.1.1
    Visit:
    http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetAvailability&id=248&id_type=biblio
    And note the unauthorized IP listed
3 - Log out, confirm all branches are listed
4 - Log in, enable StaffLoginRestrictLibraryByIP
5 - Log out, confirm branches with IPs are removed
6 - Confirm branch matching your IP is listed
7 - Choose any of the branches and login
8 - Confirm login works
Comment 2 Nick Clemens (kidclamp) 2024-05-23 12:37:43 UTC
(In reply to Martin Renvoize from comment #0)
> Question however.. how should this work for a librarian with increased
> privileges.. perhaps we should hint they're unavailable but not actually
> disable their selection for this use case?

Current code also applies to superlibrarians - they can switch to any branch once logged in, but this forces them to use a valid branch at login

As I stated elsewhere, I think the intention here was to prevent users from accidentally logging in to the wrong branch if they are not at their usual location. If you think it needs adjustment I think that's a new bug
Comment 3 David Nind 2024-05-28 00:34:08 UTC
Created attachment 167201 [details] [review]
Bug 36941: Limit login branch list when IP restriction enabled

This patch adds a new 'ip_limit' option to Koha::Template:Plugin::Branches

To test:
1 - Set some branches in the system to have random IPs
2 - Set one branch to have your IP
    To find the IP in KTD I:
    Enabled ILS-DI
    Set ILS-DI:AuthorizedIPs to 1.1.1.1
    Visit:
    http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetAvailability&id=248&id_type=biblio
    And note the unauthorized IP listed
3 - Log out, confirm all branches are listed
4 - Log in, enable StaffLoginRestrictLibraryByIP
5 - Log out, confirm branches with IPs are removed
6 - Confirm branch matching your IP is listed
7 - Choose any of the branches and login
8 - Confirm login works

Signed-off-by: David Nind <david@davidnind.com>
Comment 4 Martin Renvoize (ashimema) 2024-06-27 12:58:43 UTC
Created attachment 168196 [details] [review]
Bug 36941: Limit login branch list when IP restriction enabled

This patch adds a new 'ip_limit' option to Koha::Template:Plugin::Branches

To test:
1 - Set some branches in the system to have random IPs
2 - Set one branch to have your IP
    To find the IP in KTD I:
    Enabled ILS-DI
    Set ILS-DI:AuthorizedIPs to 1.1.1.1
    Visit:
    http://localhost:8080/cgi-bin/koha/ilsdi.pl?service=GetAvailability&id=248&id_type=biblio
    And note the unauthorized IP listed
3 - Log out, confirm all branches are listed
4 - Log in, enable StaffLoginRestrictLibraryByIP
5 - Log out, confirm branches with IPs are removed
6 - Confirm branch matching your IP is listed
7 - Choose any of the branches and login
8 - Confirm login works

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 5 Martin Renvoize (ashimema) 2024-06-27 12:59:05 UTC
Thanks Nick, 

All works as described, no regressions.. Passing QA
Comment 6 Katrin Fischer 2024-06-28 11:50:22 UTC
Pushed for 24.11!

Well done everyone, thank you!