Skip to content

feat: add a command to link existing group owners to their WordPress login - #29

Merged
vitormattos merged 1 commit into
mainfrom
fix/add-command-to-link-wordpress-users
Nov 14, 2026
Merged

vitormattos merged 1 commit into
mainfrom
fix/add-command-to-link-wordpress-users

Conversation

@YvesCesar

Copy link
Copy Markdown
Member

What was wrong

The backend treats a Nextcloud account and a WordPress user as the same person only because the uid and the user_login have the same text. To require an explicit link (see the follow-up PR), the accounts provisioned before that need to be linked, otherwise their owners can no longer log in with the WordPress password.

What changed

  • New command occ wordpress-login-backend:link-users [--dry-run].
  • It links an account by setting the user preference wordpress_login of this app to the account uid, which is the same mark Admin Group Manager records when it creates a group owner.
  • An account is linked only when it is sub-admin of the group whose id is its uid and a WordPress user has exactly that user_login (a matching e-mail does not count). Group members are never linked and are listed as skipped.
  • --dry-run lists the accounts that would be linked and the skipped ones without writing anything.
  • README documents the command.

Merge order

This PR has to be merged and the command run before (or together with) the PR that makes the link required, so existing customers keep logging in.

How it was verified

  • New unit tests for the linking rules: the owner with a WordPress login is linked; a member with a WordPress login is not; an owner that is not sub-admin of its group is not; an owner whose uid only matches a WordPress e-mail is not; --dry-run writes nothing.
  • composer run lint, composer run test:unit and the info.xml schema check pass locally.
  • On a local Nextcloud, --dry-run listed a test group owner as linked and its member as skipped.

…login

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
@vitormattos
vitormattos merged commit 38eba76 into main Nov 14, 2026
7 checks passed
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