Needs work
Project:
Drupal core
Version:
main
Component:
user system
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
8 May 2008 at 18:18 UTC
Updated:
6 Jan 2025 at 17:11 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #1
webchickHere's a first stab. I had to change user_roles() to return $role rather than just the name, and haven't begun to track down all the places this broke things.
Also todo:
- The update hook adds descriptions to anonymous/authenticated, but this needs to be done in system.install too.
- We now need the ability to edit the autheticated/anonymous roles so that their descriptions can be changed.
- Probably some tests for user_roles().
Comment #2
lilou commentedPatch still applied against CVS HEAD.
Comment #3
David_Rothstein commentedSubscribing. This seems like a really good idea.
Comment #4
rickvug commentedApplying usability tag.
Comment #5
keith.smith commented"autheticated" is a typo.
I like this patch. Descriptions for roles would be handy. I'd note that we have a couple of varying ways of showing examples in core; this one uses the 'Example: "authenticated user"' rather than the 'Example: authenticated user' approach. In another patch, one of these days, we should really conform these example strings to a single standard.
Comment #6
kika commentedNeeds screenshot
Comment #7
michaelfavia commented@webchick: if theres no complaint im going to roll this new functionality into the UI redesign of the roles page #393406: "Edit" links on roles admin page are confusing to users: "Edit permissions" should be the primary link.I dont link multiissue patches but they are very interrelated. Im going to mimic the content types page for the design and operation which leaves the ease of extension for contrib modules on the "edit link" and still lets us mitigate the permissions link on this page while adding your new functionality. ill have a patch for review on the other issue today or tomorrow morning.
Comment #8
michaelfavia commented@webchick: rolled your changes into the most recent patch on the issue above. also enabled editing of the "protected roles". your review and thoughts would be appreciated. the migration really simplified form validation and submission logic as well as creating a common UI that users already know from the content types page. im marking this issue as a duplicate but please revert if this isnt the best way to move forward.
Comment #9
David_Rothstein commentedLet's reopen this since the other issue wound up considering those changes to be out of scope.
There is some code in the other issue too though (in addition to the patch above). I assume it's pretty far out of date at this point though :)
Comment #10
David_Rothstein commentedThe linked issue is one way to do it (although probably not for Drupal 8).
Comment #11
David_Rothstein commentedThe duplicate issue (#1835668: Add description field to roles) pointed out that there's a contrib module which does this: https://www.drupal.org/project/role_help
Comment #13
anybodyBut does it really make sense to require a contrib module for something essential like that?
Every field has a description field for a very good reason > inline documentation. So if roles don't become fieldable entity in the future, there should be clearly a help text, I think!
Comment #15
meenakshig commentedComment #17
meenakshig commentedComment #18
meenakshig commenteddescription field not present for roles
Comment #24
grahlReviving this issue since the referenced module role_help has not been ported and roles aren't fieldable.
Here is a patch to bring role descriptions into the interface. Patch is against 8.9.2, will update if necessary.
Comment #26
derekcresswell commentedWe could probably provide these with descriptions, for completeness.
Poor naming choice / comment description.
Edit: Not needed at all. This is declared in the parent class.
Utilise
$this->twithin classes.Tests need to be added for this issue.
Comment #27
derekcresswell commentedAddressed all issues I outlined in #26.
Added tests for the description functions as well as the RoleListBuilder.
Comment #28
w01f commentedJust wondering if this new description field would be useable or somehow extendable to attaching specific images (media) to roles?
For example, if I wanted a different icon to represent different roles and to show the correct icon next to user names in a view (my specific use case).
Comment #29
longwave@W01F I think you are looking for #775734: Role as fieldable entity, this will only allow adding a single text field to roles.
Comment #30
longwavePatch needs work as the tests failed entirely, also I don't think we can add methods to RoleInterface except in a major version jump as this is a backward compatibility break for anything that is currently implementing it.
Comment #31
derekcresswell commentedI'm unsure why the tests failed like that, I'll give it another look.
This only adds new features and most cases where someone has overridden the roles entity they would be using this as a base already. But you are correct, this could be pushed to 10.0 in that case.
Comment #32
ridhimaabrol24 commentedTest groups arent generated due to missing @group annotation in the new test added. Fixing that.
Comment #33
derekcresswell commentedThis is the only thing I don't like. I am not sure why it does not work without the markup.
Thank you for catching the group tag. : )
Comment #35
ridhimaabrol24 commentedFixing test cases!
Comment #36
derekcresswell commentedcore/tests/fixtures/config_install/multilingual.tar.gzneeds to be updated. This is the cause for some of the test fails.Still looking into how to fix the other errors caused by the configuration difference.
Comment #37
ridhimaabrol24 commentedTrying to fix more tests!
Comment #38
ridhimaabrol24 commentedFixing the rest of the test cases!
Comment #39
ridhimaabrol24 commentedMoving to "Needs Review" as all the tests are now passing.
Comment #40
longwaveThanks for working on this!
NULL should be uppercase.
Extra blank line at start of method.
Same
Do we trim this for other descriptions? Do we need to update the comment to match?
I had BC concerns but I think looking at the policy we are OK: https://www.drupal.org/core/d8-bc-policy#interfaces
"Interfaces that are not tagged with either @api or @internal can be safely used as type hints. No methods will be changed or removed from these interface in a breaking way.
However, we reserve the ability to add methods to these interfaces in minor releases to support new features."
Why #markup for the description but not for the label?
NULL should be capitalised.
We should set some good descriptions for the Umami roles.
Is this only to make the tests pass? This feels like working around a problem that should be solved elsewhere.
Comment #41
longwaveA further thought: should we drop NULLs, use empty string as the default, and add typehints on the methods?
#3154762: [policy, no patch] All new Drupal 10 code should use appropriate type hints wherever possible is not yet policy but is starting to be followed in other new features I think.
Comment #42
derekcresswell commentedI like the idea of using an empty string by default as opposed to NULL.
Good find on the interface documentation.
As for #40.6, I was not sure why the markup was needed but without it the rows would not render properly. Now I'm thinking it may have been the NULLs. If not, no idea.
#40.9, it's definitely skirting the issue. We'll need to find out how to have it come up as not changed.
Comment #43
ridhimaabrol24 commentedImplemented suggestions from #40 except the 9th point. Still looking into the last point.
Comment #44
longwaveDo we also need to consider an upgrade path here? The descriptions should be set for anonymous and authenticated user roles on existing sites, I think.
Comment #45
paulocsFixing code standard and set description = '' instead of NULL RoleResourceTestBase.php
It still needs work.
Comment #46
ridhimaabrol24 commentedFixing few test cases!
Comment #47
ridhimaabrol24 commentedIn the failed test, the minimal profile gets installed and it picks the config from core/modules/user/config but it doesn't get the "description" field in it. Hence the test cases fail. I have checked this issue, the config in the user module is correct but in the tests, the new config doesn't get updated. Can someone suggest a step forward.
Thank you
Comment #48
raman.b commentedI think we need to update the configuration tarballs to fix the remaining tests
tests/fixtures/config_install/multilingual.tar.gztests/fixtures/config_install/testing_config_install.tar.gzComment #49
raman.b commentedTriggering the tests
Comment #50
longwaveThis is looking good, but I still think we need an upgrade path to add the description to anonymous and authenticated user roles, and tests for this.
Comment #51
paulocsSet to need work because of comment #50.
Comment #52
derekcresswell commentedComment #53
raman.b commentedAdding post update to add description to anonymous and authenticated user roles and a test for it
Comment #54
paulocsNow patch looks good.
Set to RTBC.
Comment #55
longwaveNice work, this looks really good now. RTBC+1
Comment #56
anybodyGreat work, thank you all! This is a very helpful little improvement missing since Drupal 6 :)
RTBC+1
Comment #58
quietone commentedComment #59
catchComment #60
quietone commentedSetting to NW for #59
Comment #63
megachrizI've tried to reroll the patch in #53 for the latest 9.3.x (and 9.4.x). This went mostly okay, except for the changes to tests/fixtures/config_install/multilingual.tar.gz and tests/fixtures/config_install/testing_config_install.tar.gz, from which I'm not sure yet how to update these. So I'm leaving this issue to "Needs work" because of that.
@raman.b
Can you re-add the changes needed for the tarballs?
I've also updated the issue summary and added screenshots.
Comment #65
damiaosj commentedI'll try to work on this.
Comment #66
damiaosj commentedSorry, I tried to work on this one but it's beyond my actual knowlege...
Changing the status to unassigned for someone with more experience take a look.
Comment #67
damiaosj commentedHi! I'll try to help on this one more time...
Comment #68
damiaosj commentedHi guys! Sorry... I really tried to help but didn't make it... So, I'm leaving for someone with more knowledge to work on...
Comment #69
ravi.shankar commentedFixing failed tests of patch #63.
Comment #70
alanmoreira commentedI'll work on this
Comment #71
alanmoreira commentedI was able to fix the problems on the "Installer" tests. Could not make any progress on the "Config" tests, though.
Leaving unassigned and as "Needs work".
Comment #72
alanmoreira commentedComment #73
alanmoreira commentedI'll fix the #71 patch and the interdiff because i removed some tests that i should not have removed.
Comment #74
alanmoreira commentedPatch adjusted. Leaving unassigned.
Comment #76
anybody2 years later I just saw this helpful one got stuck again as of #63.
So perhaps this should first be reviewed at a usability team meeting as of
Needs usability reviewso we can do the right things here afterwards and finally fix this?Comment #78
yoroy commentedIt's a pity these nice little usabillitytweaks get stalled. I would say this is fine to continue with. Content types, vocabularies, media types, menus all have their own description field, it's perfectly reasonable and useful to add similar for roles.
Edit: screenshots look fine, with one remark: the description text for the description text field in the edit-role screenshot essentially duplicates the label, without adding any more helpful context. It could probably be left.
Comment #79
chris matthews commentedComment #80
simohell commentedComment #81
elfakhar commentedAdding a condition on configs to not add a description on a role when it does not exist
Comment #82
elfakhar commentedComment #83
elfakhar commentedComment #84
elfakhar commentedComment #85
elfakhar commentedComment #86
elfakhar commentedComment #87
elfakhar commentedComment #88
rkollerUsability review
We've discussed this issue several times over the course of the last few months.
The first time we've discussed this issue at #3364446: Drupal Usability Meeting 2023-06-09. The link to the recording of the meeting is https://youtu.be/V_jT7Y9wWL8 . For the record the attendees at the meeting were @aaronmchale, @benjifisher, @emma-horrell, @rkoller, @simohell, and @worldlinemine.
We've revisited this issue at #3365687: Drupal Usability Meeting 2023-06-16. The link to the recording of the meeting is https://youtu.be/iriHrANnMKk . For the record the attendees at the meeting were @benjifisher, @blackbamboo, @rkoller, @shaal, and @worldlinemine.
The third and last time we've discussed this issue was in today's meeting at #3404028: Drupal Usability Meeting 2023-12-01. That issue will have a link to a recording of the meeting. For the record, the attendees at the usability meeting were @AaronMcHale, @anushrikumari, @benjifisher, @ckrina, @rkoller, @simohell, and @worldlinemine.
If you want more feedback from the usability team, a good way to reach out is in the #ux channel in Slack.
At first it has to be pointed out that there was a clear consensus right from the first meeting on that adding a description field to a role is a helpful and desirable addition.
The problem with the currently suggested descriptions is for one some sort of redundancy in the beginning of the sentences with "The role given..." or "The basic role give..." while the end of the sentences mostly mirrors the role name and doesn't add any extra value/information except for
Anonymous usersto a certain degree where it is stated that it is a role given to logged in users.Therefore we've tried to come up with suggestions for the
Anonymous user,Authenticated user,Content editor, andAdministratorrole during the three meetings as well as asynchronous discussions. It was sort of a rabbit hole if you are trying to get to a consensus for clear, concise, none redundant descriptions in plain language minding edge cases and scenarios. Three meetings plus asynchronous discussion in a Google Doc in between are testament to that. In today's call we came to the conclusion that this issue might "never" or at least not get in the near future. The missing consensus on the micro copy is just blocking a helpful and useful feature.The group would suggest the following approach to proceed:
1. Make this issue only about providing/adding a description field to a role without adding a default description for any of the roles in the
standardprofile (Anonymous user,Authenticated user,Content editor, andAdministrator) and the additional roles fordemo_umami(Author,Editor).2. Move the work on the default role descriptions to a to be created follow-up issue.
3. In regards of micro copy the only thing left to change in this issue is the description for the description field on the role edit form. At the moment the description
The description for this role.doesn't provide any value/information. It would be good to be inline with the proposed changes in #3365222: Make Description Field Labels Consistent:For the field label use:
DescriptionFor the field description use:
Displays on [the place where the description will be shown]For a content type the description for the description is for example
Displays on the Content types page.so analogous for the Roles page it would beDisplays on the Roles page.there. That way the user knows where that information will be displayed and used.Comment #89
rkollerone addition to #88.2 after some post meeting followup conversation on slack yesterday. Ideally there should be three followup issues:
Standardprofiledemo_umamiprofile ( compared to standard it is missing thecontent editorrole but hasAuthorandEditorinstead)Administratorrole on the role settings page (admin/people/role-settings). How should that change be handled in regards of the descriptions of the formerAdministratorrole and the newAdministratorrole? Because if you change theAdministratorrole from theStandardor thedemo_umamiprofile thatAdministratorrole gets set back to the initial list of permissions which is actually none: https://git.drupalcode.org/project/drupal/-/blob/9.5.x/core/profiles/sta... . Therefore its description would have to be updated and reflect those changes otherwise it would be misleading and confusing to the user. That brings up also the question if you update the description for the former Administrator role to something reflecting that this role isn't an administration role anymore still having the nameAdministratorcould also be potentially puzzling. There is also an existing issue that deals with the potential consequences of changing theAdministratorrole and the possibility of locking yourself out: #3293874: Prevent accidental lockouts on the Role settings page and clarify the corresponding description for its select box.Plus how to handle the description of the new
Administratorrole permission. Was that new role previously one of theStandardroles or a role newly created by the user? Is the old description for a role becoming the newAdministratorrole be stored in case theAdministratorrole is changed again? All details that would have to be discussed and minded in the followup.Comment #90
anybodyThanks @rkoller! Let's finish this. I think we should turn this into a MR for the last steps. I'll see what I can do in the next days. This will be a tiny, but very helpful addition!
Comment #91
jansete commentedI think that the most useful of having a role description is show this description in the roles checkboxes as description in the user form and be available for others contrib modules like role delegation.
\Drupal\user\AccountForm::form
$form['account']['roles']
Comment #92
anybody@jansete yes! Any plans to proceed here as written in #89 + #90?
Comment #93
megachrizIt looks like that the list of remaining tasks is outdated. I tried to update it based on the information from #88.
I also looked in the code and I see the following:
RoleListBuilderTest::testListBuilder()I see the following:I think that should be replaced with what is actually expected to be displayed on the screen:
@anybody, @rkoller
Can you verify if the list of remaining tasks is complete? Did I forget something?
Comment #94
rkollerI'll open a followup issue for #88.2 now. will update the issue summary here accordingly and link the issue as soon as the issue is created.
Comment #95
rkollerI've created the follow up for #88.2, and updated the issue summary accordingly linking to #3470972: Create default role descriptions for the standard profile .
UPDATE: argh while now cross checking the question from @megachriz i've realized i'Ve forgot about my comment in #89. Need to update the issue and create a second one for umami as well. after that is done i will take another look if the rest of the remaining tasks is complete. apologies.
Comment #96
rkollerComment #97
rkollerBased on #89 i've also created #3470976: Create additional default role descriptions unique to the demo_umami profile and updated the issue summary accordingly.
In regards of #93, i've made some additional slight adjustments to the issue summary. for the linked comments i've added a reference to the points made within the comment and i've added the point about #89.3 to the list of remaining tasks, that was missing so far. That way everything is covered that was raised in the ux meetings. @anybody might need to take another look if the rest of the remaining tasks looks also fine and complete.
Comment #98
jansete commentedThis issue looks very nice, although we have to unify efforts if anybody need a temporary function avoiding conflicts with the final solution of this issue, I've implemented a little module: https://www.drupal.org/project/role_description
Comment #100
megachrizSince the latest patch no longer applied on Drupal 10.4.0, I've "rerolled" the patch into a MR. And with the following changes:
$descriptionproperty in the Role classprotectedinstead ofpublic.getDescription()andsetDescription().Also attached a patch for Drupal 10.4.0, with the changes to tests removed. The MR is based on Drupal 11.1.x.
Hopefully, it passes tests.
Comment #101
smustgrave commentedThanks
So MR should point to 11.x vs 11.1.x
Also with the change we will need an upgrade hook (plus tests) that sets the description to '' for all roles
Comment #102
megachriz@smustgrave
Setting default descriptions was postponed to a follow-up, to reduce the complexity of this issue and and to increase the likelyhood of getting this done (less chance for merge conflicts). Does it then still make sense to set them to empty strings here? The code ensures that getDescription() returns an empty string when the property is not set. Or should each property of a config entity always be set?
Also, the update tests made things more complicated when rerolling patches.