question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Limit widget areas and contexts displayed on the shared dashboard to those which the user has access to

See original GitHub issue

Feature Description

Building on the work started in #4807 and #4813, users on the shared dashboard should only see widget contexts that have non-empty widget areas. As it is now, the dashboard will show all areas and contexts


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

  • The isWidgetContextActive and isWidgetAreaActive selectors of the core/widgets store should be extended with a second (optional) options parameter that includes a single modules (string[] module slugs) option (just like getWidgets)
    • The functionality of this option is already handled by getWidgets so this is mostly about passing it through where needed
    • If provided, both selectors should only consider the given context/area active if it has any non-empty areas/widgets respectively (after filtering by the given modules)
    • All usage of these selectors in the following components should be updated to include the new modules argument (from getViewableModules) if in view-only context (relying on the useViewOnly() hook from #4814)
      • DashboardEntityApp
      • DashboardMainApp
      • DashboardNavigation
      • WidgetContextRenderer
      • WidgetAreaRenderer

Implementation Brief

  • Using assets/js/googlesitekit/widgets/datastore/areas.js and assets/js/googlesitekit/widgets/datastore/contexts.js,
    • Update the following selectors to include a new optional parameter, options that includes a single modules (string[] module slugs) option (just like getWidgets).
      • isWidgetAreaActive
        • Pass modules as second parameter to the getWidgets selector.
      • isWidgetContextActive
        • Pass modules as second parameter to the isWidgetAreaActive selector.
  • Using the components listed in the last point from the AC,
    • Query the user data store via the getViewableModules selector to retrieve the list of viewable modules for the user.
    • Check if we are in view-only mode via the useViewOnly hook.
    • If in view-only mode and there is a list of modules, update calls to isWidgetAreaActive and isWidgetContextActive to include the list of viewable modules as second parameter.

Test Coverage

  • Update tests to the isWidgetAreaActive and isWidgetContextActive selectors to include tests when a list of modules is passed as second parameter.

QA Brief

See https://github.com/google/site-kit-wp/issues/4813#issuecomment-1135037589 about how to reach the shared dashboard before #5188 is done.

Once the Shared Dashboard can be viewed we should verify that only widgets which are shared with the user’s role are visible on the Shared Dashboard (both the Main and the Entity Dashboard).

The shared roles will eventually be configurable via the UI, but in order to configure them prior to the UI controls being implemented use the Dashboard Sharing tester plugin.


## Changelog entry

* Limit widget areas and contexts displayed on the shared dashboard to modules which are shared with the user.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
techanvilcommented, May 17, 2022

Hi @aaemnnosttv, thanks for pointing that out! I hadn’t spotted that subtle disconnect between the AC and the implementation.

I think we can make that correction here too, will go ahead and make it happen. Cheers

0reactions
wpdarrencommented, May 26, 2022

QA Update: ✅

Verified:

I have been through the steps in the QAB and can see that I have access to the shared dashboard, and in particular Speed widget on main and entity dashboard. I am seeing an error though Error: Site Kit can’t access the relevant data from PageSpeed Insights because you haven’t granted all permissions requested during setup. but from Evan’s update on the engineering call, these are expected right now.

The same message appears if I change access to the editor for Search Console and/or Analytics.

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Restrict responsive dashboard access to specific roles
Restrict responsive dashboard access to specific roles · Navigate to the dashboard to restrict to specific roles. · Click the context menu (...
Read more >
Sharing Dashboards - Datadog Docs
Shared dashboards and graphs allow you to display metric, trace, and log visualizations outside of Datadog. Dashboards. When you share a dashboard by...
Read more >
Create a dashboard in the Azure portal - Microsoft Learn
Open a shared dashboard​​ Select from the displayed list of dashboards. If the dashboard you want to open isn't listed: select Browse all...
Read more >
Creating a Customer Dashboard - Product Documentation
This widget is configured to read and display up to six device performance metrics that are set in the context. The user viewing...
Read more >
Dashboard Role Data Restrictions (CX) - Qualtrics
When sharing a dashboard, you can choose to limit data by user or role. Any user or role with whom the dashboard is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found