-
Notifications
You must be signed in to change notification settings - Fork 284
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
Expose recoverable modules to client #4527
Comments
IB ✔️ |
QA Update:
|
@hussain-t I found the problem here – see #4670 (comment) Would you please open a follow-up PR to fix it? @wpdarren under normal circumstances, no modules should be shown here although due to the current definition of a recoverable module To test a condition where a module would become recoverable, set up Analytics with a different user. Then change that user's role to be a non-admin. Analytics should then show up as a recoverable module. |
@aaemnnosttv sure, I will do that. Thanks for the investigation! |
@aaemnnosttv @wpdarren I have created a follow-up PR and updated the QAB. |
Thanks @hussain-t, please see my review as there are a few things there left to address. |
QA Update:
|
@wpdarren are you testing with the latest on |
@aaemnnosttv I thought I was testing with latest main, but just refreshed it again and now only 2 modules appear. 😓 So, looks like it hadn't refreshed, or, still going through the merge. |
QA Update: ✅Verified:
|
Feature Description
Module recovery is a new concept in dashboard sharing whereby a shared module can be recovered in the event that the module owner is lost. Later, we'll use this data to alert admins and prompt those who are eligible to recover the module.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
googlesitekit-dashboard-sharing-data
script data should be extended to include a newrecoverableModules
property as a list of module slugs (string[]
) that are recoverableownerID
ownerID
no longer (one of the following)AUTHENTICATE
)Implementation Brief
In
Core/Assets/Assets.php
updateget_inline_dashboard_sharing_data()
$inline_data
add a propertyrecoverableModules
which will be an array of module strings.First fetch the list of shareable modules
get_shareable_modules()
(introduced in #4521),For each shareable module get the owner id
get_owner_id()
site-kit-wp/includes/Core/Modules/Module_With_Owner.php
Line 29 in cf9bada
If the owner ID doesn't correspond to a valid user (
get_user_by( 'ID', $owner_id )
)https://developer.wordpress.org/reference/functions/get_user_by/
Add the module slug to the
recoverableModules
array.If the owner is not authenticated, add the module slug to the
recoverableModules
array.See
site-kit-wp/includes/Core/Authentication/Authentication.php
Line 625 in cf9bada
Also ensure you're checking the module owner, and not the current user, code snippet:
site-kit-wp/includes/Core/Authentication/Authentication.php
Lines 664 to 671 in cf9bada
If the owner ID does not have the
AUTHENTICATE
capability, add the module slug to therecoverableModules
arrayuser_can( $owner_id, Permissions::AUTHENTICATE );
https://developer.wordpress.org/reference/functions/user_can/
Test Coverage
QA Brief
dashboardSharing
via the tester pluginwindow._googlesitekitDashboardSharingData
roles
andrecoverableModules
recoverableModules
array should have the module slugs if the criteria is met as mentioned in the ACdashboardSharing
via the tester pluginwindow._googlesitekitDashboardSharingData
in the browser developer consoleundefined
as a value of the above propertyUpdate:
Changelog entry
The text was updated successfully, but these errors were encountered: