Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Conversation

@ahegyes
Copy link
Contributor

@ahegyes ahegyes commented May 12, 2023

Refactors the remove-user command to bring it in line with the commands added in the last 9 months or so thus removing the dependency on the deprecated API_Helper and making use of more reusable functions.

At the same time, provides a warning for when a WPCOM site could not be queried as suggested by #162.

@nickpagz
Copy link
Contributor

@ahegyes This looks and works great, though I did come across a warning, and there was one slightly confusing bit in the output, not a big deal, but bringing it up anyways.

First, I tested with --list, then without --list and aborting, and finally without --list and confirming removal.

The confusing part:
I added my personal email as a collaborator on tumblr-swag-store-development.mystagingwebsite.com via Pressable without WP Access. I was already a "customer" on the site, but the command reports me as a "collaborator". It was confusing since the site shows up twice, once as a pressable site ID, and then again as a wpcom site ID. I understand why it shows up twice, it just took me a couple minutes to understand why.
Now, this is probably not a big deal for our 51 sites, but in a perfect world we could check for type of access before removing the user, and only remove users with a certain level of access. Having said, we probably couldn't check for custom roles or permissions and it's probably better to just nuke the user anyways (and add them back later if needed).

Overall though, it works perfectly as intended.

The PHP warning:
This showed up on the confirmation run:
PHP Warning: Undefined property: stdClass::$email in /Users/nickp/team51-cli/src/commands/remove-user.php on line 128
I think line 128 should be $this->user, or, add 'email' in the returned array on line 215. I didn't fully debug though, so not 100% sure on what's included in that object.

A compiled screenshot of the output:
Markup on 2023-05-30 at 13:39:17

@ahegyes ahegyes force-pushed the fix/162-remove-user-enhancements branch from 33d1413 to 591df3a Compare June 6, 2023 17:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants