Skip to content

new plugin to add users to a location_us group if they login from a US IP address#1877

Merged
nkissebe merged 3 commits into
2.4-mainfrom
feature/plg-auth-us_create
May 5, 2026
Merged

new plugin to add users to a location_us group if they login from a US IP address#1877
nkissebe merged 3 commits into
2.4-mainfrom
feature/plg-auth-us_create

Conversation

@pascal-meunier
Copy link
Copy Markdown
Contributor

Motivation: file permissions require a group for people in the US. Filling the iplocation table of the network database with a copy of the ip ranges applicable to the us is silly because that's a lot of rows to copy and it creates a management problem to keep the copy up to date. Instead, this plugin uses an SQL query with a join operation.

Three files created under core/plugins/user/us/:

  • us.php — on login, queries the ipcountry table in the geo database using INET_ATON(). If countrySHORT == 'US', adds the user to location_us. Logs both the
    match and non-match cases. On account deletion, removes the user from location_us (with is_object() guard).
  • us.xml — extension manifest
  • language/en-GB/en-GB.plg_user_us.sys.ini — admin UI label

…if they are in the d1_nation group. The purdue group will supersede the location_us group through unix ACLs that will allow access to people in the purdue group for things that are restricted to people in the US
@pascal-meunier
Copy link
Copy Markdown
Contributor Author

New commit will remove people from location_us group if they login from elsewhere or if they are in the d1_nation group. The purdue group will supersede the location_us group in the sense that unix ACLs will allow access to people in the purdue group for things that are restricted to people in the US.

…#__xgroups with discoverability=1 (hidden) and join_policy=3 (closed), using INSERT IGNORE so a re-run is safe. down() deletes the group before removing the plugin entry. Both operations are guarded by a tableExists check.
@nkissebe nkissebe merged commit bbba0a1 into 2.4-main May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants