Skip to content

created plugin to add users to a D1 nations group if they login from an IP address from one of those nations#1878

Merged
nkissebe merged 4 commits into
2.4-mainfrom
feature/plg-auth-d1_create
May 6, 2026
Merged

created plugin to add users to a D1 nations group if they login from an IP address from one of those nations#1878
nkissebe merged 4 commits into
2.4-mainfrom
feature/plg-auth-d1_create

Conversation

@pascal-meunier
Copy link
Copy Markdown
Contributor

Motivation: file permissions require a group for people from D1 nations. Filling the iplocation table of the network database with a copy of the ip ranges applicable to the D1 nations group 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.

Does plg_user_purdue duplicate what plg_user_geo could do if it was configured to use the purdue group and the "pu" location? From what I can see both use custom locations in the iplocation table of the network database, in this case it would be the "pu" location
[7:09 PM]There's a need to put users from D1 nations into a group at login, so that the tool access limitation done in PHP can be mirrored in the filesystem permissions for /apps by setting UNIX acls using that group

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

  • d1.php — on login, runs the JOIN query against the geo database. If no row is returned (IP not in any country group), returns immediately without touching group membership. If
    countrygroup == 'D1', adds the user to d1_nation. Any other countrygroup is logged but ignored. On account deletion, removes the user from d1_nation.
  • d1.xml — extension manifest
  • language/en-GB/en-GB.plg_user_d1.sys.ini — admin UI label (edited)

…ves them from d1_nation and returns without doing any geo database lookup
@pascal-meunier
Copy link
Copy Markdown
Contributor Author

New commit: At login, if the user is a member of d1_approved, the plugin now removes them from d1_nation and returns without doing any geo database lookup. The existing geo-based logic runs only for users not in d1_approved.

@nkissebe nkissebe merged commit 527a6a3 into 2.4-main May 6, 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