-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Allow network admins to manage application passwords for all users #8638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Changes from all commits
18d4cc2
674a0f8
5d81620
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1112,4 +1112,36 @@ private function setup_app_password_authenticated_request() { | |
|
|
||
| return $item; | ||
| } | ||
|
|
||
| /** | ||
| * @ticket 60029 | ||
| * @group ms-required | ||
| */ | ||
| public function test_create_item_for_user_without_role_on_main_site() { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These tests are interesting but the only question that comes to my mind is that I can't see with these tests is that the actual method |
||
| if ( ! is_multisite() ) { | ||
| $this->markTestSkipped( 'Test only runs in multisite' ); | ||
| } | ||
|
|
||
| wp_set_current_user( self::$admin ); | ||
|
|
||
| $blog_id = self::factory()->blog->create(); | ||
Sukhendu2002 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $user_id = self::factory()->user->create(); | ||
|
|
||
| // Remove user from main site if they were automatically added. | ||
| if ( is_user_member_of_blog( $user_id ) ) { | ||
| remove_user_from_blog( $user_id, get_current_blog_id() ); | ||
| } | ||
| add_user_to_blog( $blog_id, $user_id, 'subscriber' ); | ||
|
|
||
| $this->assertFalse( is_user_member_of_blog( $user_id ) ); | ||
|
|
||
| $request = new WP_REST_Request( 'POST', sprintf( '/wp/v2/users/%d/application-passwords', $user_id ) ); | ||
| $request->set_body_params( array( 'name' => 'Test App' ) ); | ||
| $response = rest_do_request( $request ); | ||
| $this->assertSame( 201, $response->get_status() ); | ||
|
|
||
| $passwords = WP_Application_Passwords::get_user_application_passwords( $user_id ); | ||
| $this->assertCount( 1, $passwords ); | ||
| $this->assertSame( 'Test App', $passwords[0]['name'] ); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.