Make WordPress Core

Opened 13 years ago

Last modified 3 days ago

#25016 assigned defect (bug)

XMLRPC method "wp.getUsers" not working correctly in Multisite

Reported by: dinomic Owned by:
Priority: normal Milestone:
Component: XML-RPC Version: 3.5
Severity: normal Keywords: has-patch has-unit-tests
Cc: Focuses: multisite

Description

Hi,

I have been testing some functionality in our app which uses XMLRPC, and it appears that I've found a bug with how the "wp.getUsers" method works on WordPress.com blogs.

Basically, the blog I'm testing this on has 3 administrators. Regardless of which one of those administrators' credentials I use, whenever we call the "wp.getUsers" method we ONLY get details for the SAME user back. So, if we have 3 admins ('admin1', 'admin2', 'admin2'), whenever 'admin1' queries for all users, they only get back 'admin1'.

I also tried adding a different type of user, specifically an author, and then used any of the above-mentioned administrator credentials to try and retrieve info on that author, but nothing is returned.

It should be noted that all the above functionality works as it should on self-hosted blog, just NOT on WordPress.com blogs.

Change History (13)

#1 @markoheijnen
13 years ago

  • Keywords needs-patch removed
  • Milestone Awaiting Review
  • Resolution → invalid
  • Severity critical → normal
  • Status new → closed

This isn't a support forum for WordPress.org. As you indicated it does work for self hosted blog. I don't know if WordPress.com changed something but I think it is best to ask for support at their forums.

#2 follow-ups: @dinomic
13 years ago

Hi markoheijnen. Thanks for your suggestion.

I appreciate that this is not a wordpress.org issue *at present*, but the main reason I had flagged it as an issue here was because I was under the impression that WordPress.com code eventually gets pulled over to WordPress.org. Eg, the software version numbers of Wordpress.com blogs reads as follows right now: "3.7-alpha-24954".

Also, I was under the impression that the WordPress.com blog was for regular user support, not for reporting bugs.

Anyway, I have now posted on the WordPress.com forum to see what happens...

#3 in reply to: ↑ 2 @helen
13 years ago

Replying to dinomic:

I was under the impression that WordPress.com code eventually gets pulled over to WordPress.org.

It's actually (usually) the other way around. :)

#4 @markoheijnen
13 years ago

WordPress.com does run the latest code or some kind of development version depending on the current state. I don't remember any recent changes in WordPress that would effect your behavior. The people of WordPress.com can look into way better then we can. Also since they use a lot of custom code what can effect this.

#5 in reply to: ↑ 2 @nacin
13 years ago

Replying to dinomic:

I appreciate that this is not a wordpress.org issue *at present*, but the main reason I had flagged it as an issue here was because I was under the impression that WordPress.com code eventually gets pulled over to WordPress.org. Eg, the software version numbers of Wordpress.com blogs reads as follows right now: "3.7-alpha-24954".

If you see that, you may not be looking at a WordPress.com blog. The meta generator tag for WordPress.com is always "WordPress.com".

While it works on a self-hosted blog, it would be good to confirm that it works in multisite for self-hosted, as that is what WP.com is.

#6 @markoheijnen
13 years ago

  • Milestone → Awaiting Review
  • Resolution invalid
  • Status closed → reopened

This is probably a cause of

if ( current_user_can( 'edit_user', $user_data->ID ) )
     $_users[] = $this->_prepare_user( $user_data, $fields );

I'm not sure but maybe this check can be removed since there is already a capability check current_user_can( 'list_users' )

I'm reopening it for further investigation.

#7 @nacin
13 years ago

In multisite, only super admins have the edit_users capability. To a mere administrator who can list users, _prepare_user() might return more data than they can otherwise see in a user list. (Granted, not much — like registered date, names other than the display name, etc.)

One option could be to only allow fields => basic in multisite. Or throw it out the window and allow all current fields. That said, let's create a unit test that verifies that a regular administrator only receives the current list of fields. That way if any more fields are added in the future, we don't get surprised that a regular administrator in multisite sees data that they shouldn't.

#8 @SergeyBiryukov
13 years ago

  • Version trunk → 3.5

Related: [21824] (for #18428).

#9 @markoheijnen
13 years ago

  • Owner set to markoheijnen
  • Status reopened → assigned

#10 @dd32
11 years ago

  • Focuses multisite added
  • Summary XMLRPC method "wp.getUsers" not working correctly on WordPress.com → XMLRPC method "wp.getUsers" not working correctly in Multisite

#11 @wonderboymusic
11 years ago

  • Keywords needs-patch added
  • Owner markoheijnen removed

Anyone can patch this

This ticket was mentioned in ​PR #14277 on ​WordPress/wordpress-develop by ​@jorgelopezrepiso.


3 days ago
#12

  • Keywords has-patch has-unit-tests added; needs-patch removed

Trac ticket:
https://core.trac.wordpress.org/ticket/25016

Use of AI Tools

#13 @jorgelopezrepiso
3 days ago

I've confirmed the bug on a local Multisite installation with 53 users (50 subscribers, 2 administrators, 1 author). Calling wp.getUsers with a regular site administrator returned only that administrator.

The patch removes the redundant edit_user capability check, which in Multisite is mapped to do_not_allow for non-super-admins and was discarding all users except the current one. It also forces fields => basic for non-super-admins in Multisite, as suggested by @nacin, so that site administrators can list users but only see basic fields.

I've added an unit test that verifies a regular site administrator receives all users with only the basic fields.

Note: See TracTickets for help on using tickets.