Bug 36665 - Autolocation and IP Recognition
Summary: Autolocation and IP Recognition
Status: Signed Off
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low critical (vote)
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords:
Depends on: 35918
Blocks:
  Show dependency treegraph
 
Reported: 2024-04-22 12:35 UTC by olivier.delangle
Modified: 2024-05-17 13:13 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 36665: Add option to set the staff user's logged in branch based on their current ip (9.92 KB, patch)
2024-05-17 12:14 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 36665: Add option to set the staff user's logged in branch based on their current ip (9.98 KB, patch)
2024-05-17 13:12 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description olivier.delangle 2024-04-22 12:35:58 UTC
Since the modification of the Autolocation syspref functionality, the previous feature is no longer possible. 

A new syspref should be implemented to restore it, meaning: 

for terminals with IPs declared for the branch, the connection to the professional interface defaults to the IP's branch rather than the member's affiliated branch.
Comment 1 David Cook 2024-04-22 23:39:38 UTC
At a glance, it looks like AutoLocation is working the same. Can you be more specific about the issue you're having?
Comment 2 David Cook 2024-04-22 23:46:43 UTC
Wait... I think I understand you. You mean you weren't using AutoLocation to try to restrict logins?

You were just trying to use AutoLocation to force the branch of the session to the branch of the physical location (as designated by the IP address).

So arguably that desired functionality would be AutoLocation and the restricting by IP address would be renamed as per bug 26176.

--

That's an interesting idea.
Comment 3 olivier.delangle 2024-04-23 06:04:09 UTC
That's right. 

This feature allowed individuals not affiliated with the library to work there without having to switch branch with each session. 
This is particularly useful, of course, in networks composed of multiple libraries. 

It was indeed very useful and practical.
Comment 4 Nick Clemens (kidclamp) 2024-05-17 11:12:57 UTC
I am raising the severity here. Before bug 35918 if a library specified IPs in the branches table a user would be logged in to the correct branch based on their IP when AutoLocation was disabled

Now, this does not happen.

If AutoLocation is enabled, the user can only log in if their current IP matches the branch in their account.

This is a huge behavior change and negatively affects large consortia where staff travel between branches
Comment 5 Nick Clemens (kidclamp) 2024-05-17 12:14:20 UTC
Created attachment 166889 [details] [review]
Bug 36665: Add option to set the staff user's logged in branch based on their current ip

This patch adds a new system preference StaffLoginBranchBasedOnIP which restores the behaviour before bug 35918
of using the current IP to determine the user's logged in branchcode

To test:
 1 - Get your current ip
 2 - Set that IP for a library in the administration section
 3 - Find a user account assigned to a different library that can login to staff side
 4 - Login to staff as that user, select 'My library'
 5 - You are logged in to the user's branch
 6 - Apply patch, restart all
 7 - Log out and back in, selecting 'My library'
 8 - You are logged in to the user's branch
 9 - Enable new system preference StaffLoginBranchBasedOnIP
 9 - Log out and back in, selecting a different branch, noting the new warning below the library selection
10 - You are logged in to the branch with the matching IP
11 - Log out and back in, selecting 'My library'
10 - You are logged in to the branch with the matching IP
11 - Change your logged in branch
12 - Verify the selection sticks and you can perform staff actions in the chosen branch
13 - Change the IP of the library to one that doesn't match yours
14 - Verify you can log out and log back in and that selected branch is respected when your IP doesn't match library IP
Comment 6 Martin Renvoize 2024-05-17 13:12:38 UTC
Created attachment 166904 [details] [review]
Bug 36665: Add option to set the staff user's logged in branch based on their current ip

This patch adds a new system preference StaffLoginBranchBasedOnIP which restores the behaviour before bug 35918
of using the current IP to determine the user's logged in branchcode

To test:
 1 - Get your current ip
 2 - Set that IP for a library in the administration section
 3 - Find a user account assigned to a different library that can login to staff side
 4 - Login to staff as that user, select 'My library'
 5 - You are logged in to the user's branch
 6 - Apply patch, restart all
 7 - Log out and back in, selecting 'My library'
 8 - You are logged in to the user's branch
 9 - Enable new system preference StaffLoginBranchBasedOnIP
 9 - Log out and back in, selecting a different branch, noting the new warning below the library selection
10 - You are logged in to the branch with the matching IP
11 - Log out and back in, selecting 'My library'
10 - You are logged in to the branch with the matching IP
11 - Change your logged in branch
12 - Verify the selection sticks and you can perform staff actions in the chosen branch
13 - Change the IP of the library to one that doesn't match yours
14 - Verify you can log out and log back in and that selected branch is respected when your IP doesn't match library IP

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>