Bug 11180 - IP branch attribute should accept CIDR notation and add multiple ip
Summary: IP branch attribute should accept CIDR notation and add multiple ip
Status: Failed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: George Veranis
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-31 21:57 UTC by Pablo AB
Modified: 2024-01-10 18:16 UTC (History)
6 users (show)

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


Attachments
Bug 11180: IP branch attribute should accept CIDR notation (5.00 KB, patch)
2022-03-18 15:50 UTC, George Veranis
Details | Diff | Splinter Review
Bug 11180: IP branch attribute should accept CIDR notation and add multiple ip (1.73 KB, patch)
2022-03-18 19:07 UTC, George Veranis
Details | Diff | Splinter Review
Bug 11180: IP branch attribute should accept CIDR notation (3.69 KB, patch)
2024-01-08 23:23 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 11180: IP branch attribute should accept CIDR notation and add multiple ip (1.73 KB, patch)
2024-01-08 23:23 UTC, Chris Cormack
Details | Diff | Splinter Review
Bug 11180: IP branch attribute should accept CIDR notation and add multiple ip (1.73 KB, patch)
2024-01-09 19:12 UTC, Phan Tung Bui
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.