Problem/Motivation

A shortcut set can be assigned to an individual user, but there is no way to assign a shortcut set as the default for a specific role.

Proposed resolution

The Shortcut Per Role module solves this problem in Drupal contrib. However, this module has a serious limitation which, IMHO, excludes it from consideration for inclusion into Drupal core until it can be resolved properly in contrib.

The Shortcut Per Role module works well when each user is generally assigned a single role like "administrator", "content editor", "moderator", "user admin", etc. However that module become complicated and less useful if your roles and permissions model is such that each user has multiple roles. This is the strategy that was adopted with Acquia's Lightning distro, where each content type on the site had a "Type creator" and "Type editor" role. This permissions approach allows for fine-grain control for large teams, but makes building competing shortcut sets per role a very challenging problem. The module currently handles this issue by inheriting the shortcut set assigned to the highest weighted role, but at least one person found this annoying and would rather combine sets. Combining sets comes with its own set of issues as well, such as the order links should appear in, the strategy to reduce duplicate links, and the UX issue caused when a user has many roles making the shortcut list of links extremely long and untenable inside a Toolbar.

Probably the only sane approach is to either allow the user to select from a list of shortcut sets that have been allowed for one or more of the roles they have, or have a dropdown to let users swap out shortcut sets right from the shortcut bar itself.

Remaining tasks

Decide on an approach to handle multiple qualifying shortcut sets for users that have multiple roles.

User interface changes

TBD.

API changes

TBD.

Data model changes

TBD.

Release notes snippet

TBD.

Original report by @mariomaric

Posted by zenlan on February 9, 2011 at 2:07pm @ d.o forum:

I am able to assign a shortcut set to an individual user but can't find a way to assign that shortcut set as the default for a specific role.

Is it possible to assign a shortcut set to a role via configuration?

Comments

David_Rothstein’s picture

It's not possible using the core Shortcut module alone, but it would be easy to write a contrib module that extends the core module to provide that functionality; the place to start there is hook_shortcut_default_set().

Not sure if anyone's tried writing it yet, though.

mariomaric’s picture

Status: Active » Fixed

Hi David,

thx for your quick reply and for the hint for extending Shortcut module.

Another way is probably to just wait for the D7 port of a Toolbar module (if there will be one).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dynamicdan’s picture

Priority: Normal » Major
Status: Closed (fixed) » Needs work

This is annoying me..

I want to assign a shortcut set to a role which I thought would be the main use of having shortcut sets. This should be core functionality.
Otherwise, remove the shortcut sets ability as it just confuses people with it's lack of ability.

mariomaric’s picture

Version: 8.x-dev » 7.x-dev
Category: feature » support
Status: Active » Closed (fixed)
Bojhan’s picture

Version: 7.x-dev » 8.x-dev
Category: support » feature
Priority: Major » Normal
Status: Needs work » Active
webankit’s picture

Version: 7.x-dev » 8.x-dev
Category: support » feature
Status: Closed (fixed) » Active

For D7
git clone --branch master http://git.drupal.org/sandbox/babbar.ankit/1150940.git shortcut_per_role

David_Rothstein’s picture

Awesome - great start on that module!

Are you planning to submit it as a real project once you're ready to move it out of your sandbox? (If so and if you need someone to review your project application, I'd be glad to help.)

I just went through and looked at the code now and filed a couple issues in your sandboxes issue queue, to give you an idea of some issues that could be improved. But overall, it looks like a great start to me.

daniela basualdo’s picture

Assigned: Unassigned » daniela basualdo

+1

mshepherd’s picture

@babbar.ankit - have you got any further towards getting htis module released. It sounds like really useful functionality and makes sense of the idea of shortcut sets. Without it, shortcut sets don't really make sense to me.

Good luck!

webankit’s picture

My module is complete but no one has approved my application since then. If you can help...

Bojhan’s picture

Do you have a link?

webankit’s picture

mshepherd’s picture

Looks like this project has been approved at:

http://drupal.org/project/shortcutperrole

mariomaric’s picture

Yay! :)

@webankit: congrats!

I think this could and should stay as feature request for D8..

mshepherd’s picture

I agree - it makes sense for this to be a core feature.
While its good to assign shortcuts per user, it would be much more sensible to assign shortcuts per role

webankit’s picture

Thanks.
Plz tell me if I can help to port this in core, D8.

andypost’s picture

+1 to have it in core
Just simply provide a patch for core.

dynamicdan’s picture

+1 for core.

If this was already there then I could have more easily extended the solution than using another third party library to 'hack' a solution for my problems.

uno’s picture

Ah, another module I have to install.

+1 for core

Ivanhoe123’s picture

+1 for core

webankit’s picture

Assigned: daniela basualdo » webankit

I will work on this on this weekend...

andypost’s picture

tgeller’s picture

Issue summary: View changes

@andypost, I think the problem with that roadmap issue is that it's in the 7.x branch, and therefore isn't being noticed (and considered) for inclusion.

Does it make sense for @webankit to open an 8.x branch just to switch it over there? Forgive my ignorance about procedure... I just want to make sure this doesn't fall through the cracks.

andypost’s picture

This is a feature, so first we need to port the module to 8.x and then wait for approval of the feature.
At least it could be done in 8.1, 8.2

mgifford’s picture

Assigned: webankit » Unassigned

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.

jibran’s picture

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

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

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now 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.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.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.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). 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.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now 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.

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.

jwilson3’s picture

Addressing #25, the Shortcut Per Role module was ported to Drupal 8 and has now been updated for compatibility with Drupal 9. However, this module has a serious limitation which, IMHO, excludes it from consideration for inclusion into Drupal core until it can be resolved properly in contrib.

The module works well when each user is generally assigned a single role like "administrator", "content editor", "moderator", "user admin", etc. However this module become complicated and less useful if your roles and permissions model is such that each user has multiple roles. This is the strategy that was adopted with Acquia's lightning, where each content type on the site had a "Type creator" and "Type editor" role. This gives fine-grain control for large teams, but makes building competing shortcut sets per role a very challenging problem. The module's behaviour is currently to inherit the shortcut set assigned to the highest weighted role, but at least one person found this annoying and would rather combine sets.

I was granted maintainership of the module to shepherd the Drupal 9 compatibility, and don't really have long term plans to figure out this hard problem on my own, but I'm open to ideas on how to approach providing an option to merging sets.

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.

zuruckzugehen’s picture

Replying to #39, I think the merge solution is not a good one.
You can end up with two many links and there is no way to decide the order, the way you do with a menu in Drupal -what it is, in the end, the shortcuts menu.

I think the solution would be having a select element with all the roles a user has and seeing the shortcuts for each role separately. The roles could be ordered by weight or by alphabetical order (perhaps in an environment with many rols the alphabetical is clearer). Of course, the default set of shortcuts would be the ones belonging to the first role in the select element.

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.

jwilson3’s picture

Issue summary: View changes