Allow multiple ip ranges per user

Created on 21 January 2021, almost 4 years ago
Updated 25 November 2024, 24 days ago

Problem/Motivation

Contrary to the "unlimited" D7 version of this module the ip_login field has a cardinality of 1. This makes it impossible to migrate from D7 to D8 without breaking current behaviour.

Proposed resolution

Update the field cardinality to unlimited and allow the process to match multiple values.

Remaining tasks

  • Write patch
  • Update existing field

User interface changes

N/A

API changes

Data model changes

Feature request
Status

Needs work

Version

4.0

Component

Code

Created by

🇳🇱Netherlands erik frèrejean 🏴‍☠️

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇷🇴Romania amateescu

    This needs an upgrade path for sites that are using the current version of the module.

  • First commit to issue fork.
  • 🇦🇺Australia akoepke

    Can a maintainer please review this merge request and push out a new release of the module.

    At the moment, upgrading a site from D7 to D10 while maintaining the IP login functionality isn't really possible.

  • 🇷🇴Romania amateescu

    I tested the upgrade path on a test site with existing data and sadly it doesn't work. The entity api can't create the database tables for a field if that field name is already "installed", so I'm afraid we'll have to add a new field instead. Something like ip_login_data or ip_login_range?

  • 🇷🇴Romania amateescu

    Also, I've committed 💬 How to logout? Active so it can be reverted from this MR.

  • 🇦🇺Australia akoepke

    I have changed the field to ip_login_data and updated the database update hooks and SQL in the controller. I also added another database update to remove the ip_login field.

    I was testing the upgrade path from the current 4.0.0-alpha2, is this the same version you were testing? I just did a clean install of the current release and then replaced it with this code and the upgrade went through without any issues.

  • First commit to issue fork.
  • 🇦🇺Australia realityloop

    does not currently apply to dev branch, I've just updated the MR, apologies for losing individual commits, I exported patches for each of them before rebasing dev in attached archive

  • 🇦🇺Australia realityloop

    perhaps becauuse my DB is already converted:

    drush updb -y
     ---------- ----------- --------------- --------------------------------------------------------------- 
      Module     Update ID   Type            Description                                                    
     ---------- ----------- --------------- --------------------------------------------------------------- 
      ip_login   9002        hook_update_n   9002 - Migrate ip address values from old field to new table.  
      ip_login   9003        hook_update_n   9003 - Remove single value IP Login field from User entity.    
     ---------- ----------- --------------- --------------------------------------------------------------- 
    
    
     // Do you wish to run the specified pending updates?: yes.                                                             
    
    >  [notice] Update started: ip_login_update_9002
    >  [error]  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ip_login__ip_start' in 'field list': SELECT uid, ip_login__ip_start, ip_login__ip_end
    >     FROM users_field_data
    >     WHERE ip_login__ip_start IS NOT NULL; Array
    > (
    > )
    >  
    >  [error]  Update failed: ip_login_update_9002 
     [error]  Update aborted by: ip_login_update_9002 
     [error]  Finished performing updates. 
    
  • 🇦🇺Australia realityloop

    I've just added a check that the columns exist in the ip_login_update_9002() install hook

  • Pipeline finished with Skipped
    20 days ago
    #354055
  • 🇷🇴Romania amateescu

    Cleaned up the update functions a bit and merged into 4.x, thanks!

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024