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
Comment #1
David_Rothstein CreditAttribution: David_Rothstein commentedIt'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.
Comment #2
mariomaric CreditAttribution: mariomaric commentedHi 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).
Comment #4
dynamicdan CreditAttribution: dynamicdan commentedThis 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.
Comment #5
mariomaric CreditAttribution: mariomaric commentedComment #6
Bojhan CreditAttribution: Bojhan commentedComment #7
webankit CreditAttribution: webankit commentedFor D7
git clone --branch master http://git.drupal.org/sandbox/babbar.ankit/1150940.git shortcut_per_role
Comment #8
David_Rothstein CreditAttribution: David_Rothstein commentedAwesome - 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.
Comment #9
daniela basualdo CreditAttribution: daniela basualdo commented+1
Comment #10
mshepherd CreditAttribution: mshepherd commented@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!
Comment #11
webankit CreditAttribution: webankit commentedMy module is complete but no one has approved my application since then. If you can help...
Comment #12
Bojhan CreditAttribution: Bojhan commentedDo you have a link?
Comment #13
webankit CreditAttribution: webankit commentedhttp://drupal.org/node/1150952
Comment #14
mshepherd CreditAttribution: mshepherd commentedLooks like this project has been approved at:
http://drupal.org/project/shortcutperrole
Comment #15
mariomaric CreditAttribution: mariomaric commentedYay! :)
@webankit: congrats!
I think this could and should stay as feature request for D8..
Comment #16
mshepherd CreditAttribution: mshepherd commentedI 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
Comment #17
webankit CreditAttribution: webankit commentedThanks.
Plz tell me if I can help to port this in core, D8.
Comment #18
andypost+1 to have it in core
Just simply provide a patch for core.
Comment #19
dynamicdan CreditAttribution: dynamicdan commented+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.
Comment #20
uno CreditAttribution: uno commentedAh, another module I have to install.
+1 for core
Comment #21
Ivanhoe123 CreditAttribution: Ivanhoe123 commented+1 for core
Comment #22
webankit CreditAttribution: webankit commentedI will work on this on this weekend...
Comment #23
andypostFiled a roadmap issue #1811630: Merge shortcut per role module in core shortcut 8.x
Comment #24
tgeller CreditAttribution: tgeller commented@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.
Comment #25
andypostThis 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
Comment #26
mgiffordComment #31
jibranComment #39
jwilson3Addressing #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.
Comment #43
zuruckzugehen CreditAttribution: zuruckzugehen at Seidor commentedReplying 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.
Comment #45
jwilson3