In the Shortcut module, there is a very poorly named permission.

Current: Select own shortcut set
What it should be: Select any shortcut set

The current usage can be understood properly, sort of, as in, "I get to have my very own shortcut set... so I can pick from any of the ones on the site." That is a stretch. But what makes the current use of "own" just awful is that the word "own" is used in another permission in a very different way: "Edit own shortcut set." "Own" in that context means specifically, the one you created. For the one I want to change, "own" means, "it's yours in that you chose it."

Summary: in one permission "own means" you created it while in another permission "own" means you chose it. Very confusing. Since "any" is such a good alternative for the choosing permission, we should use it.

I've written a patch for it, and it is attached.

Shai

Comments

jhodgdon’s picture

Title: "Select own shortcut set" needs to be changed to "Select any shortcut set" » Shortcut permission names are misleading

Actually, the "Edit own shortcut set" allows you to edit the set you are currently using. Here's the function (note that the machine name for this permisison is 'customize shortcut links'):

function shortcut_set_edit_access($shortcut_set = NULL) {
  // Sufficiently-privileged users can edit their currently displayed shortcut
  // set, but not other sets. Shortcut administrators can edit any set.
  if (user_access('administer shortcuts')) {
    return TRUE;
  }
  if (user_access('customize shortcut links')) {
    return !isset($shortcut_set) || $shortcut_set == shortcut_current_displayed_set();
  }
  return FALSE;
}

So... I'm OK with "Select any shortcut set" being the name for the "select" permission.

I think the edit permission needs to say "Edit selected shortcut set", to be consistent with the "select" permission's wording, and what the edit permission actually allows you to do. It doesn't have anything to do with whether you or someone else created the shortcut set. It only has to do with if it's your currently-selected shortcut set.

And those two changes should also make it clearer on the Permissions page that someone who is given both the permissions basically has permission to edit any shortcut set on the system (by first selecting then editing that set).

Shai’s picture

StatusFileSize
new2.52 KB

@jhodgdon,

Great catch!

So now there are changes to all three perms description strings in the patch:

-      'title' => t('Administer shortcuts'),
+      'title' => t('Administer all shortcut sets'),
     ),
     'customize shortcut links' => array(
-      'title' => t('Edit own shortcuts'),
+      'title' => t('Edit selected shortcut set'),
     ),
     'switch shortcut sets' => array(
-      'title' => t('Select own shortcut set'),
+      'title' => t('Select any shortcut set'),

Shai

Status: Needs review » Needs work

The last submitted patch, 685020-2-better-perm-strings.patch, failed testing.

Status: Needs work » Needs review

Re-test of 685020-2-better-perm-strings.patch from comment #2 was requested by jhodgdon.

jhodgdon’s picture

Status: Needs review » Needs work

There's a typo in the patch on #2:
"... and each user with Select any shortcut set permission to select a shortcut site created by anyone at the site...."

to select => can select

I'm also not sure about "Administer all shortcut sets". That doesn't seem to match the other permissions in core, such as "Administer content" and "Administer content types". ??

ADDED LATER: To be explicit -- I think this should just be left as "Administer shortcuts" to make it match the other permissions in core.

Shai’s picture

Status: Needs work » Needs review
StatusFileSize
new2.4 KB

The attached patch fixes the mangled sentence in hook_help.

I just checked, and it turns out that "Administer shortcuts" is a sort of super permission for the module. If you have that one checked, you don't need the other two checked since "Administer shortcuts" has the power of the other two. So indeed my suggestion on that was bad.

The current patch does take the "s" off. So now it is "Administer shortcut." The module name is "Shortcut" not "Shortcuts."

Shai’s picture

Hmmm, "Administer shortcut" sounds really weird. Maybe "Administer shortcuts" is better. What think yous.

jhodgdon’s picture

Status: Needs review » Needs work

I think it should be Administer shortcuts. Permissions describe the actions you can take, not the name of the module (which is kind of invisible for most actions). For instance for the Node module, the master-admin permission is called "Administer content", not "Administer Node" (anyway, if we were using module names it would have to be "Administer everything in Node module" I think, whereas "Administer content" is clearer and more concise).

Shai’s picture

@jhodgdon,

I'll re-roll back to "Administer shortcuts" but I still don't like it. And I think similar problems exist for other modules as well, maybe because we were aiming for terseness in perm names at the expense of clarity.

In this case "Administer shortcuts" sounds like the permission has specifically to do with the shortcuts themselves... as in working within a set to add or take away shortcuts. But, what this permission in fact is doing is creating a super admin perm for anything to do with the shortcut module. That isn't transparent.

I'll roll a new one in a couple minutes.

Shai

Shai’s picture

Status: Needs work » Needs review
StatusFileSize
new2.26 KB

New patch, to summarize:

1. Patch changes a few words in hook_help to reflect one of the new perm names.
2. Changes two of three perm names: from: 'Edit own shortcuts' to 'Edit selected shortcut set' and from: 'Select own shortcut set' to 'Select any shortcut set'.

jhodgdon’s picture

I completely approve of the patch in #10.

I think we should get a 3rd opinon before marking it RTBC however, probably from someone who's been involved in recent other issues on shortcuts, such as Bojhan or anyone else who's been commenting on #647084: Missing shortcut edit and delete operations on shortcuts admin. Try #drupal-contrib on IRC to find them?

David_Rothstein’s picture

I think this is good, especially the "Select any shortcut set" part.

I'm not 100% sure about "Edit selected shortcut set" - how clear is it from that that the user might not have selected it themselves, but rather had it assigned to them by someone else? I agree that "own" is a bit confusing here (although nice in one way, in that it imitates the any/own distinction used elsewhere, e.g. in the node module permissions).

I dunno, maybe: "Edit displayed shortcut set"?

I also think if we need more clarity on this one, we might consider adding a permission description. The Shortcut module used to have some permission descriptions until many of the permission descriptions were removed from core en masse, but we could probably start fresh and come up with a better one instead.

jhodgdon’s picture

I thought the word "selected" was pretty clear here, actually, especially since the other permission was called "Select any shortcut set".

The word "displayed" to indicate the shortcut set someone is currently using is in the code, but is not used in the UI anywhere, I think.

Shai’s picture

While we are waiting to get a third opinion on what needs fixing here... Berdir on the development list just pointed out this to me:

http://api.drupal.org/api/function/hook_permission/7

hook_permission allows modules to create a second line under the name of the perm for more verbose explanation. A lot of core modules aren't using that functionality at all. Though some are. The contrib module Devel uses it really well.

No matter what permission names we decide to re-write, we can take advantage of the 'Description' key in hook_permission in order to give some more verbose help to what these perms actually mean.

Shai

jhodgdon’s picture

Yes, that can be done. But it should only be done if we are unable to make the permission strings themselves clear.

David_Rothstein’s picture

Hm, you mean like in #12 where I suggested we might add back a permission description here... or something else? :)

Anyway, agreed that it would be nice if we can make things clear without relying on a description.

I kinda want to RTBC this one, but my brain is still getting a bit caught on the "edit selected" wording.... Is it possible we are all overthinking this a bit, and that leaving that part at "edit own shortcut set" is fine after all? It's consistent with the rest of Drupal, and while it's true that there are subtleties here (e.g., it's not really your "own" because you might not have created it, or you might be sharing it with other users, etc), I'm not sure those are really any different than the subtleties associated with "edit own ___ content". In the case of content, just because you "own" it doesn't mean that you're the only one who can edit it (and certainly not the only one who can view it), nor does it even mean you created it; an administrator might have created it and entered your name in the author field. So are the shortcut permissions really that different?

dries’s picture

Another option is 'current' or 'active' (instead of 'selected' or 'displayed')?

jhodgdon’s picture

The problem with using the word "own" here for the shortcut set you've selected, in my opinion, is that elsewhere in permissions it means "that you created", whereas here it means "that you selected".

Hmmm...

OK, I think we do need to have descriptions. How about this?

- Select any shortcut set
From all available shortcut sets, select one to be own active set. Without this permission, an administrator selects shortcut sets for users.

- Edit currently selected shortcut set
May affect other users if shortcut sets are shared. If also granted Select any shortcut set permission, effectively grants permission to edit any available shortcut set.

Shai’s picture

Re: #18, +1. This would be a huge improvement.

Shai

jhodgdon’s picture

Status: Needs review » Needs work

OK Shai, the two of us agree - let's get a patch made. I can do it in a few hours probably (quite busy at the moment) unless you get there first. :)

jhodgdon’s picture

Status: Needs work » Needs review
StatusFileSize
new2.26 KB

Here's a patch with the changes from #18. Please, someone review it. :)

jhodgdon’s picture

StatusFileSize
new7.36 KB

And for reference, here's a screen shot of the shortcut permissions, with this patch applied.

jhodgdon’s picture

Incidentally, I tried to make the permission name EM there, but it didn't work (i.e. If also granted Select any shortcut set permission). The permissions page must be stripping out the HTML tags in the description field.

Shai’s picture

@jhodgdon,

Thanks for sticking with this... sorry for my delay in getting back.

Hmm, upon both inspecting as well as applying the patch in #21: 685020-10-better-perm-strings_0.patch, it seems that you uploaded the wrong patch. The patch you uploaded looks like an exact copy of the one I posted in #10. Even the name of the patch is the same as the one in #10. I actually applied it before inspecting it, and noticed that the "descriptions" that you proposed in #18 are, indeed, nowhere to be found.

So hopefully the right patch is just sitting on your desktop somewhere... give it another go :)

Shai

jhodgdon’s picture

StatusFileSize
new2.56 KB

Doh!

Shai’s picture

Patch applied cleanly. It's working as expected.

I have some wordsmithing suggestions, however.

May affect other users if shortcut sets are shared. If also granted Select any shortcut set permission, effectively grants permission to edit any available shortcut set.

I'd propose instead:

If any users on the site are granted the "Select any shortcut set" permission, this permission will allow users to change shortcut sets used by others. If also granted "Select any shortcut set" permission, effectively grants permission to edit any shortcut set.

I did a major rewrite on the first sentence, and I don't like the rewrite. But what I didn't like in the way you wrote it is that it suggests that there is "share shortcut set" functionality somewhere. It implies that I might be able to "own" a shortcut set and then voluntarily "share" it with others. Which is not the case. That kind of functionality exists in a lot of places, and the language will cause users to expect it. The data architecture/permissions relationships here are totally screwed up, not intuitive, and we are just in damage control here.

Can you take a crack at editing what I wrote, or maybe rewrite what you wrote but without the "share" concept?

On the second sentence, my edit is almost the same as yours, but I ripped out the word "available." Isn't it totally redundant? There is no "publish/unpublish" shortcut setting. If it is there, it is available if you have the permission.

For "Select any shortcut set" -- I'd just remove the word "available" for the same reason I just described... unless I'm missing something here.

Sorry I didn't notice these things when I wrote #19... but it is funny how applying a patch and looking at it in the UI makes notice different things.

jhodgdon’s picture

Ummmm...

A user without Select permission can still be using a shared set of shortcuts, if an admin assigns the same shortcut set to more than one person. So the ability to affect other users is not limited to people with "Select any shortcut set" permission. That's why I wrote it that way. I thought the word "shared" conveyed that idea?

I'm OK with removing the word "available" from the second description.

Shai’s picture

@jhodgdon,

Check this out... I really think this one is a lot better:

Proposed description for the "Edit currently selected shortcut set" permission:

Editing the currently selected set will affect other users if that set has been assigned to or selected by other users. If also granted "Select any shortcut set" permission, effectively grants permission to edit any shortcut set.

Shai

jhodgdon’s picture

Yes, better! Except now the second sentence seems stylistically disconnected from the first and kind of jarred me reading it... How about:

Editing the currently selected shortcut set will affect other users if that set has been assigned to or selected by other users. Granting "Select any shortcut set" permission along with this permission will grant permission to edit any shortcut set.

Shai’s picture

StatusFileSize
new2.63 KB

Excellent! Might we be there?

dries’s picture

This might be personal taste, but I find 'Edit currently selected shortcut set' terribly long. It has one word too much.

Shai’s picture

StatusFileSize
new2.61 KB

Okay, I made changes: For review:

Currently in head: Edit own shortcuts
Patch #30: Edit currently selected shortcut set
Patch #32: Edit current shortcut set

To be consistent I also changed in the description
Patch #30: Editing the currently selected shortcut set will affect other users...
Patch #32: Editing the current shortcut set will affect other users...

Shai

jhodgdon’s picture

I am completely happy with the latest patch. Since I participated in writing it, though, I guess I shouldn't mark it RTBC (but I would if I could).

jhodgdon’s picture

David_Rothstein’s picture

I love the permission names now, but the descriptions feel a little long.... I think in general we want to keep permission descriptions as short as possible. A couple of those sentences don't seem like they're adding too much information. Would this work instead?

"Edit current shortcut set":
Editing the current shortcut set will affect any other users who have selected that set or been assigned to use it.

"Select any shortcut set":
Without this permission, users can only see the current shortcut set that was assigned to them.

jhodgdon’s picture

I think the main idea is to put information in the descriptions that wouldn't be obvious at first glance, and only if it is important from a security perspective or adminstration perspective.

With this in mind, I'm in favor of keeping the "Granting "Select any shortcut set" permission along with this permission will grant permission to edit any shortcut set." warning on "Edit current shortcut set".

I don't like the second proposed change much either... "see" -- where? "current shortcut set" -- what does that mean?

I think the proposal in the patch is clearer:
"'From all shortcut sets, select one to be own active set. Without this permission, an administrator selects shortcut sets for users.'"

David_Rothstein’s picture

Hm, well if it isn't somewhat clear from the permission names alone that "Select any shortcut set" and "Edit current shortcut set" give you (effective) permission to edit any set, I'm not sure we've named them right? It's probably only a small number of people who will care about that anyway. I'm not totally opposed to leaving it in, but it feels long.

For the second one, I was trying to match the terminology between the two permissions, so that both refer to "current shortcut set". Otherwise, do you think it will be clear to people that "active set" (in the second description) refers to the same thing as "current set" (in the first one)?

dries’s picture

Either work for me. Therefore, I'm delegating the decision on this to jhodgdon -- she can roll or approve the final patch, and I'll commit what she recommends me on this issue.

jhodgdon’s picture

Status: Needs review » Reviewed & tested by the community

Ah, the power!

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to CVS HEAD.

Status: Fixed » Closed (fixed)

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