Bug 11180

Summary: IP branch attribute should accept CIDR notation and add multiple ip
Product: Koha Reporter: Pablo AB <pablo.bianchi>
Component: System AdministrationAssignee: George Veranis <gveranis>
Status: Failed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: dcook, gmcharlt, gveranis, katrin.fischer, matthias.le-gac, michael.hafen, phan-tung.bui
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28657
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 11180: IP branch attribute should accept CIDR notation
Bug 11180: IP branch attribute should accept CIDR notation and add multiple ip
Bug 11180: IP branch attribute should accept CIDR notation
Bug 11180: IP branch attribute should accept CIDR notation and add multiple ip
Bug 11180: IP branch attribute should accept CIDR notation and add multiple ip

Description Pablo AB 2013-10-31 21:57:19 UTC
The most common way to talk about an IP range is the CIDR notation, for example "157.93.48.0/22, 157.93.53.0/25, 157.93.54.0/25", instead of using an asterisk (current "157.93.48.*" notation), which limit the mask to /24. I think koha should handle both notations, or at least instead CIDR, which is much more flexible.

As in the example also sometimes is necessary to deal with more than one subnet (comma separated) at the same time (I could fill another bug for this one).

Of course all this is particularly useful to AutoLocation system preference.
Comment 1 George Veranis 2022-03-18 15:50:46 UTC
Created attachment 131927 [details] [review]
Bug 11180: IP branch attribute should accept CIDR notation

This patch adds the ability to set more than ip to IP setting of a branch and
also CIDR notation can recognised also.

Test plan:
1) Change systempreference AutoLocation to "Yes"
2) Go to the library settings ( Administration -> Libraries ) and you can add
   only one ip at format xxx.xxx.xxx.xxx or xxx.xxx.*
3) Apply patch
4) Go to the library settings and you can enter to IP setting
   those ip(s) you want seperate by space in any format like xxx.xxx.xxx.xxx or
   xxx.xxx.xxx.0/24 or xxx.xxx.xxx.* or only one also on the same formats.
3) Logout
4) Try to login from an ip that not belong on the set of ip that you enter
   before and now CIDR notation can regognized also and also you can have more
   than one ip for restriction.
Comment 2 George Veranis 2022-03-18 19:07:41 UTC
Created attachment 131933 [details] [review]
Bug 11180: IP branch attribute should accept CIDR notation and add multiple ip

This patch adds the ability to set more than ip to IP setting of a branch and
also CIDR notation can recognised also.

Test plan:
1) Change systempreference AutoLocation to "Yes"
2) Go to the library settings ( Administration -> Libraries ) and you can add
   only one ip at format xxx.xxx.xxx.xxx or xxx.xxx.*
3) Apply patch
4) Go to the library settings and you can enter to IP setting
   those ip(s) you want seperate by space in any format like xxx.xxx.xxx.xxx or
   xxx.xxx.xxx.0/24 or xxx.xxx.xxx.* or only one also on the same formats.
3) Logout
4) Try to login from an ip that not belong on the set of ip that you enter
   before and now CIDR notation can regognized also and also you can have more
   than one ip for restriction.
Comment 3 Chris Cormack 2024-01-08 23:23:26 UTC
Created attachment 160669 [details] [review]
Bug 11180: IP branch attribute should accept CIDR notation

This patch adds the ability to set more than ip to IP setting of a branch and
also CIDR notation can recognised also.

Test plan:
1) Change systempreference AutoLocation to "Yes"
2) Go to the library settings ( Administration -> Libraries ) and you can add
   only one ip at format xxx.xxx.xxx.xxx or xxx.xxx.*
3) Apply patch
4) Go to the library settings and you can enter to IP setting
   those ip(s) you want seperate by space in any format like xxx.xxx.xxx.xxx or
   xxx.xxx.xxx.0/24 or xxx.xxx.xxx.* or only one also on the same formats.
3) Logout
4) Try to login from an ip that not belong on the set of ip that you enter
   before and now CIDR notation can regognized also and also you can have more
   than one ip for restriction.
Comment 4 Chris Cormack 2024-01-08 23:23:37 UTC
Created attachment 160670 [details] [review]
Bug 11180: IP branch attribute should accept CIDR notation and add multiple ip

This patch adds the ability to set more than ip to IP setting of a branch and
also CIDR notation can recognised also.

Test plan:
1) Change systempreference AutoLocation to "Yes"
2) Go to the library settings ( Administration -> Libraries ) and you can add
   only one ip at format xxx.xxx.xxx.xxx or xxx.xxx.*
3) Apply patch
4) Go to the library settings and you can enter to IP setting
   those ip(s) you want seperate by space in any format like xxx.xxx.xxx.xxx or
   xxx.xxx.xxx.0/24 or xxx.xxx.xxx.* or only one also on the same formats.
3) Logout
4) Try to login from an ip that not belong on the set of ip that you enter
   before and now CIDR notation can regognized also and also you can have more
   than one ip for restriction.
Comment 5 Phan Tung Bui 2024-01-09 19:12:58 UTC
Created attachment 160721 [details] [review]
Bug 11180: IP branch attribute should accept CIDR notation and add multiple ip

This patch adds the ability to set more than ip to IP setting of a branch and
also CIDR notation can recognised also.

Test plan:
1) Change systempreference AutoLocation to "Yes"
2) Go to the library settings ( Administration -> Libraries ) and you can add
   only one ip at format xxx.xxx.xxx.xxx or xxx.xxx.*
3) Apply patch
4) Go to the library settings and you can enter to IP setting
   those ip(s) you want seperate by space in any format like xxx.xxx.xxx.xxx or
   xxx.xxx.xxx.0/24 or xxx.xxx.xxx.* or only one also on the same formats.
3) Logout
4) Try to login from an ip that not belong on the set of ip that you enter
   before and now CIDR notation can regognized also and also you can have more
   than one ip for restriction.
Comment 6 Phan Tung Bui 2024-01-09 19:17:45 UTC
Attempted to apply the batch, but encountered an Internal Server Error.
Comment 7 Matthias Le Gac 2024-01-09 19:23:45 UTC
 According to the logs, the error probably comes from the file : C4/Auth.pm
Comment 8 David Cook 2024-01-10 04:56:42 UTC
(In reply to Phan Tung Bui from comment #6)
> Attempted to apply the batch, but encountered an Internal Server Error.

Did you apply the database update? It looks like they forgot to mention that step in their test plan.
Comment 9 Matthias Le Gac 2024-01-10 14:23:27 UTC
Yes I apply the DB. I try again and I have again the 500 error.

What I do :
1) git reset
2) git pull
3) update the DB
4) apply the patch
5) update DB
6) go to koha

and I have the 500 error and log :

/inlibro/git/koha-master-dev-matthias/C4/Auth.pm has too many errors.
Compilation failed in require at /inlibro/git/koha-master-dev-matthias/errors/500.pl line 21.
BEGIN failed--compilation aborted at /inlibro/git/koha-master-dev-matthias/errors/500.pl line 21.

I missed something ?
Comment 10 Michael Hafen 2024-01-10 18:16:11 UTC
Please check the bug in the "See also" for an alternate implementation.