The attached patch, rolled against 7.x-2.x-dev provides Views integration for the ip_login_user data table.
It also provides a default view to list IP Login users at admin > people > ip login
Attached,
cheers,
DT
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | ip-login-view-example.png | 90.84 KB | davidwhthomas |
| #1 | 1587134-ip_login.views-integration.patch | 19.63 KB | davidwhthomas |
| ip_login.views-integration.patch | 19.21 KB | davidwhthomas |
Comments
Comment #1
davidwhthomas commentedUpdated patch, to supersede the first, that includes the hook_views_api in ip_login.module
Comment #2
davidwhthomas commentedHere's a somewhat redacted screenshot of the default IP Login users view attached.
Comment #3
davidwhthomas commentedI'm looking into a patch to provide a Field API field for IP Login, perhaps using the field_ipaddress module.
The Field API automatically provides Views integration, so this patch can probably wait until then.
It does work on the current codebase however.
Comment #4
jim kirkpatrick commentedI reckon having the IP Address Field module as a dependency is the best move, since that module will mean we can abstract all storage/validation for IP addresses to something that specialises in it.
There are some issues though with this approach, though:
hook_updateand migrate code to move from theip_login_userstable to this field. OR support both, which kinda sucks from a code redundancy/maintenance/legacy PoV.So at this point in time I don't see much point in supporting any other field types as we then need a load of extra validation code for nothing. So my current preferred approach is:
What do you think? It's a question of how we get from here to there, as well as defining where 'there' is... It might be worth double-checking if there are alternatives to that IP field module, too.
Comment #5
davidwhthomas commentedThanks Jim,
I like the idea of a dependency on field_ipaddress too, as the module specialises in IP address handling and also makes it quite easy to do the IP range matching to user.
As for the issues you mentioned:
While there is a CIDR notation widget available, I've been testing with the "Shorthand" widget ( x.* ) which is more end-user friendly.
Theoretically, a familiar user could switch to use the CIDR style widget instead.
Does the current version of ip_login support both styles in the one textfield? If so, that may be a problem as it looks like the widget needs to be one or the other.
field_ipaddress does handle the required ranges, e.g 203.0.0.0 - 203.45.3.12, 203.45.0.0 - 203.45.3.12, or 203.45.3.12-14 as well as 203.45.3.*
Yes, just using the field storage is alot simpler here and saves duplication and rework.
I'm thinking either an update hook, or a page where an end-user can migrate the data across. Migration is quite easy to do.
Yes, that makes sense, we'd keep the existing approach for the 6.x branch.
As for:
Agreed.
Cheers,
DT
Comment #6
davidwhthomas commentedOK, I've got an update working with field_ipaddress.
As field_ipaddress takes care of all the validation while data storage and retrieval is all done by the Field API, it means we're able to remove quite a bit of code from the base ip_login module, such as insert, update hooks/code
I've also put together an update hook that creates the field_ip_login ip address field and uses the batch api to migrate user ip data across to it.
All my 195 test IP addresses were migrated successfully across to the new field, including address patterns like
123.45.67.*
123.45.*.*
123.45.67.89/24
So that's looking good too.
cheers,
DT
Comment #7
davidwhthomas commentedJim, there's a new 7.x-3.x branch committed to git that contains a working copy of IP Login using the field_ipaddress module.
An update hook / upgrade path is provided there for migration.
I'm thinking to publish a new 7.x-3.x-alpha/beta branch with this update soon.
Please test it out and let me know what you think.
cheers,
David
Comment #8
jim kirkpatrick commentedComment #9
jim kirkpatrick commentedUpdating and clarifying... Cheekily assigning to David, too!
Comment #10
davidwhthomas commentedHeh, yes, this one's ready for testing.
Using it myself.
Cheers,
DT
Comment #11
peterx commentedGood to see the IP address field has useful indexes for high speed lookup. The unlimited number of addresses will remove our requirement to replace the 255 byte address field with 2000 bytes. Looking forward to beta testing. Two thumbs up!
Comment #12
dwatts3624 commentedI've noticed mention of D6 support here. Are there any plans to do that or should we just anticipate waiting until our project is upgraded to D7?
Also, the main need is to include the data in a report/view. If there's a path to include the used range in a user view using the D6 version that we've missed a path to the documentation there would be greatly appreciated!
Comment #13
jim kirkpatrick commentedD6 support isn't planned by me, and there's no 6 verison of http://drupal.org/project/field_ipaddress so I would imagine this will be 7+ only, unless someone finds an alternative IP Address field module, or ports that one.
Comment #14
amateescu commentedClosing old issues.