Follow up for #1920468: Write tour integration for the first page after install showing extend and other things

Problem/Motivation

As mentioned by sun in http://drupal.org/node/1809352#comment-7048718 we might be providing to much information for the basic user by providing all the tips to whoever has the single permission.

Proposed resolution

A role based system so certain high level tips can be provided to a subset of experts.

Remaining tasks

Discuss, and better define the problem motivation.

User interface changes

No.

API changes

This might require an extra field in the yml file. Depending on the outcome of the discussion. However this would only be an addition, not a break change.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

nick_schuch’s picture

Status: Active » Needs review
FileSize
9.58 KB

Here is a patch that adds permissions to tips (and test coverage). It sets up the following:

1) Automatically adds a permission per module that implements a tour.
2) Tour module now has a "View all tips" (same approach as nodes modules "View all content").
3) Modules can also add in there own permissions and assign them to the tip like so:

id: tour-test
module: tour_test
label: Tour test english
langcode: en
paths:
  - tour-test-1
tips:
  tour-test-4:
    id: tour-test-4
    plugin: text
    permission: view awesome tour tips     <------ This is the new line.
    label: The awesome tip
    body: A sensational tip.
    weight: "2"
    attributes:
      data-id: tour-test-4

This now means that modules can provide tips to varying levels of user base. While I don't see this as being required in our core tip implementations (we should keep them as simple as possible). I do see this as a big deal for contrib.

larowlan’s picture

+++ b/core/modules/tour/lib/Drupal/tour/TourRenderController.phpundefined
@@ -22,23 +22,28 @@ public function viewMultiple(array $entities = array(), $view_mode = 'full', $la
+        if (user_access('view all tour tips') || user_access($tip_permission)) {
+          if ($output = $tip->getOutput()) {

these can be in one if imo

+++ b/core/modules/tour/tests/tour_test/tour_test.moduleundefined
@@ -8,6 +8,18 @@
+function tour_test_permission() {
+  return array(
+    'view awesome tour tips' => array(
+      'title' => t('View awesome tour tips'),
+      'description' => t('View awesome tour tips.'),
+    ),
+  );

Correct me if I'm wrong but this permission would show up in the 'Tour test' module section in the permission ui whilst the other permissions would show up in the tour module permissions section. I think we would also get a 'view tour_test tips' permission too - so which wins in that case? Looking at the code I can see the permission defined by the module wins, but that isn't clear to the user from the permissions ui.

+++ b/core/modules/tour/tour.moduleundefined
@@ -10,12 +10,27 @@
+    $path = drupal_get_path('module', $module) . '/' . $module . '.info.yml';

Can this be cached (in memory), one module might define two tours - no need to parse the info file twice.

+++ b/core/modules/tour/tour.moduleundefined
@@ -106,10 +121,6 @@ function tour_toolbar() {
-  if (!user_access('access tour')) {
-    return;

This means this code runs on every page now, not sure if that is desirable, or if we can get around it.

nick_schuch’s picture

Thanks larowlan.

I will do the following:

1) Consolidate the if statement.
2) Basically this would provide specific permissions for a specific few tips within a tour. Think of it like a "View expert views ui tips". I will update the test_module for the permission to read better.
3) Ill take advantage of this: drupal_container()->get('keyvalue')->get('system.schema')->getAll() (keeping in mind that this is now service::).
4) Im not sure how to keep this simple either. I guess in the end we have to check for which users can access what tips.

oresh’s picture

Status: Needs review » Needs work
nick_schuch’s picture

Status: Needs work » Needs review
FileSize
8.73 KB
5.97 KB

The following patch fixes the items identified by @larowlan in #3.

nick_schuch’s picture

#5: 1921144-5-tour-tip-permission.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 1921144-5-tour-tip-permission.patch, failed testing.

nick_schuch’s picture

Status: Needs work » Needs review
FileSize
8.24 KB
3.55 KB

Rerolled vs current HEAD.

Status: Needs review » Needs work

The last submitted patch, 8: 1921144-8-tour-tip-permission.patch, failed testing.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

ridhimaabrol24’s picture

Version: 8.9.x-dev » 9.1.x-dev
Issue summary: View changes
ridhimaabrol24’s picture

Status: Needs work » Needs review
FileSize
6.62 KB
8.8 KB

Rerolled patch for 9.1.x!

Status: Needs review » Needs work

The last submitted patch, 20: 1921144-20.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Hardik_Patel_12’s picture

Status: Needs work » Needs review
FileSize
6.81 KB
1.14 KB

Failed tests are because of undefined method user_access().
user_access() replaced with a method on the user/accountInterface , kindly see Change Record.

Solving failed test cases. Kindly follow a new patch.

Status: Needs review » Needs work

The last submitted patch, 22: 1921144-22.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

This extension is being deprecated, see #3336033: [Meta] Tasks to deprecate Tour module. It will be removed from core and moved to a contrib project, #3376099: [11.x] [Meta] Tasks to remove Tour.

This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.