Opened 5 years ago
Last modified 2 months ago
#7339 new enhancement
[Patch] Display full user names instead of user login
| Reported by: | michael.grundberg@… | Owned by: | |
|---|---|---|---|
| Priority: | high | Milestone: | next-major-releases |
| Component: | general | Version: | 0.11.5 |
| Severity: | normal | Keywords: | username user review |
| Cc: | mian.hasan.khalil@…, vslavik@…, itamarost@…, thijstriemstra, macke@…, osimons, shoffmann, leho@…, taylor@…, martin.prikryl@…, bobov_a@…, franz.mayer@…, sterkrig@…, locher.hanspeter@…, boris.savelev@…, ryano@…, benco@…, djones@…, arkinform@…, ober.sebastian@…, fcorreia@… | ||
| Release Notes: | |||
| API Changes: | |||
Description
In some environments the user login names are cryptic since they are set by a central IT department using some number system or what else. It would be preferable to have trac display the full user names wherever possible so there is a fair chance to know who changed what.
Attached is a patch against the released version of 0.11rc2 which will display the full user names in all places which uses the Chrome.format_author function, if the user has set it in the preferences and the administrator has turned it on in the configuration. I also added the use of format_author in the assign to field of tickets, if it is configured to display a drop down list.
All existing tests run, but I did not create any new tests for this enhancement.
This patch might collide with ticket 2178.
Attachments (11)
Change History (77)
Changed 5 years ago by michael.grundberg@…
comment:1 Changed 5 years ago by ebray <hyugaricdeau@…>
comment:2 Changed 5 years ago by anonymous
I would definitely like see this rolled into the main trunk!
comment:3 follow-ups: ↓ 11 ↓ 42 Changed 5 years ago by cboos
- Keywords username added
- Milestone set to 0.13
- Owner jonas deleted
This looks interesting, but calling env.get_known_users is costly. So for one this should only be done if the show_full_names option is selected. Then, caching that information in the Chrome instance is not a good idea since there's currently no way to get notified when this information changes. Recomputing the cache in each format_author makes the cache useless and is of course too costly. One interim solution might be to cache it in the req.
A better solution should be found as part of the user API changes, planned for 0.13. I'm rescheduling this for 0.13, but feel free to propose an interim patch taking the ideas above (or better ones) into account.
comment:4 Changed 5 years ago by ebray <hyugaricdeau@…>
cboos: Are any of your ideas for the user/group API documented, or is it just in your head for now? I'd be interested in talking about that at some point as I've done a bit of work related to that. I have a plugin that provides users and user meta data from an external DB, and monkey patches env.get_known_users among other things. But its current incarnation is kind of ugly, so I'd be interested in what your thoughts are on the subject.
comment:5 Changed 5 years ago by cboos
Sorry, not even in my head, I was referring to various ideas floating around (see #2456) and the fact that there's a general agreement that some improvement is needed in this area and that it should happen hopefully not later than 0.13…
comment:6 Changed 4 years ago by cboos
comment:7 Changed 4 years ago by dserodio@…
- Cc dserodio@… added
Couldn't the "create user" WebAdmin function invalidate the cache?
PS.: Why doesn't the spam filter let me post?
comment:8 Changed 4 years ago by Matthew Caron <Matt.Caron@…>
I have attached an updated patch against trac 0.11.5. It expands on Michael's patch, munges it in to 0.11.5 so it (should) apply cleanly, and adds lookups in a couple of spots (ticket queries, etc.) which were missed.
comment:9 Changed 4 years ago by mian.hasan.khalil@…
- Cc mian.hasan.khalil@… added
Another vote for seeing something like this integrated to the trunk.
comment:10 Changed 4 years ago by Hasan Khalil <mian.hasan.khalil@…>
I've added a patch for another couple of cases that were missed. There are definitely more in notification.py but I wasn't able to get it to play nice. I haven't really ever used python before, so do audit that code before you run it locally! I'd love to see someone else pick up where I left off with notification.py and finish the job. That seems to be really the only other place that e-mail obfuscation occurs instead of substituting with full names.
comment:11 in reply to: ↑ 3 ; follow-up: ↓ 13 Changed 4 years ago by Hasan Khalil <mian.hasan.khalil@…>
- Version changed from 0.11rc2 to 0.11.5
Replying to cboos:
This looks interesting, but calling env.get_known_users is costly. So for one this should only be done if the show_full_names option is selected.
comment:12 Changed 3 years ago by Vaclav Slavik <vslavik@…>
- Cc vslavik@… added
comment:13 in reply to: ↑ 11 ; follow-up: ↓ 14 Changed 3 years ago by cboos
Replying to Hasan Khalil <mian.hasan.khalil@…>:
Replying to cboos:
This looks interesting, but calling env.get_known_users is costly. So for one this should only be done if the show_full_names option is selected.
Thanks! Patch looks good, you're on the right track ;-) Still:
- trac/ticket/web_ui.py, in old = chrome. chrome is not defined here. A bit of refactoring is needed here so that there's only one chrome = Chrome(self.env) in this method;
- The docstring for show_full_names should add a caveat saying: "This option is potentially resource intensive for sites with lots of users." (or anything better phrased);
- Finally, Chrome.user_map is caching some data coming from the database, and as such its content should be adequately updated when needed. This can be achieved using the cached attributes we introduced in 0.12. Some work should be done in order to find the proper places where the cache has to be invalidated.
comment:14 in reply to: ↑ 13 Changed 3 years ago by dekimsey@…
Replying to cboos:
- Finally, Chrome.user_map is caching some data coming from the database, and as such its content should be adequately updated when needed. This can be achieved using the cached attributes we introduced in 0.12. Some work should be done in order to find the proper places where the cache has to be invalidated.
If a user's information is updated, persistent-processes will not pickup on the new information until they are reloaded. This is because the user_map is generated in env as cboos has noted. The hacky solution is to simply touch the trac.ini file to force it to reload.
Changed 3 years ago by Vaclav Slavik <vslavik@…>
comment:15 follow-up: ↓ 17 Changed 3 years ago by Vaclav Slavik <vslavik@…>
I'm attaching modified version of the patch. Changes:
- Fixed trac/ticket/web_ui.py problem. Chrome(self.env) is relatively cheap, so I just added it at the beginning of the function.
- Docstring fixed.
- Changed to show full name even to anonymous requests. Previously, show_full_names meant "show full names to users that would otherwise be shown unmangled email address", I think it makes more sense like this.
- If showing email address is permitted, display Full Name <email@address.com> instead of Full Name. This is consistent with the way email addresses of unauthenticated users are shown by Trac. More importantly, it wouldn't be possible to contact registered submitters without this change.
I'm not sure if 4. is the right thing to do. Ideally, user names would be clickable links (either mailto: or using e.g. reCAPTCHA Mailhide), but that would be a huge change out of this patch's scope.
I didn't port the patch to 0.12 and its caching framework yet.
comment:16 Changed 3 years ago by cboos
comment:17 in reply to: ↑ 15 Changed 3 years ago by KlauX <klaux1@…>
Replying to Vaclav Slavik <vslavik@…>:
I'm attaching modified version of the patch. Changes:
- Fixed trac/ticket/web_ui.py problem. Chrome(self.env) is relatively cheap, so I just added it at the beginning of the function.
- Docstring fixed.
- Changed to show full name even to anonymous requests. Previously, show_full_names meant "show full names to users that would otherwise be shown unmangled email address", I think it makes more sense like this.
- If showing email address is permitted, display Full Name <email@address.com> instead of Full Name. This is consistent with the way email addresses of unauthenticated users are shown by Trac. More importantly, it wouldn't be possible to contact registered submitters without this change.
I'm not sure if 4. is the right thing to do. Ideally, user names would be clickable links (either mailto: or using e.g. reCAPTCHA Mailhide), but that would be a huge change out of this patch's scope.
I didn't port the patch to 0.12 and its caching framework yet.
This patch is upside down?
comment:18 Changed 3 years ago by cboos
- Keywords review added
comment:19 Changed 3 years ago by itamaro
- Cc itamarost@… added
- Keywords user added
comment:20 Changed 3 years ago by lkraav <leho@…>
- Cc leho@… added
comment:21 Changed 3 years ago by alexander.papaspyrou@…
- Cc alexander.papaspyrou@… added
comment:23 Changed 2 years ago by thijstriemstra
- Priority changed from normal to high
Increasing the priority of this enhancement, judging by the cc's.
comment:24 Changed 2 years ago by Marcus Lindblom <macke@…>
- Cc macke@… added
comment:25 Changed 2 years ago by ajax
This patch doesnt work with TRAC 0.12.2rc1
comment:26 Changed 2 years ago by anonymous
I could not patch version 0.12.2. The diff failed in three places. I rolled back to 0.12 and ran the diff and everything patched fine. I added the show_full_names under the [trac] directive in the trac.ini and made sure that my full name was filled in under preferences but I cannot get this to work. Is there any other changes I need to make to implement this? Also I am running this under ubuntu so am I supposed to patch the /usr/local/lib/python2.6/dist-packages/ version or the /usr/lib/python2.6/dist-packages. Sorry, I am kind of a noob when it comes to this. Thanks a lot.
comment:27 Changed 2 years ago by Poly <polyflor@…>
I am working on a working patch for 0.12.2. It should be postable by the end of this month.
comment:28 Changed 2 years ago by Poly <polyflor@…>
Find enclosed the patch for 0.12.2 (r2).
- Fixed: works with 0.12.2
- Added: Using a cached attribute for 'known_users' (as discussed above)
- Added: Test cases for the global flags (show_email_addresses and show_full_names)
- Added: Ticket Owner and Reporter are clickable when shown in full and point to the reporting page (same as in unpatched versions)
- Open: Notification.py see comments above and also #7862
There is also an oddity I stumbled upon: If show_email_addresses is true and show_full_names is false the Reporter and Owner fields are shown as logins (as long as your logins do not contain an at-sign). This behaviour has been present ever since the show_email_addresses has been implemented. I did not touch this dial, because I do not know the intenion of the flag for the Reporter and Owner field in this case. If you like other behaviour you should be able to adapt the format_author() method. Last but not least that is why I provided some test cases.
Hope this helps.
comment:29 follow-up: ↓ 32 Changed 2 years ago by cboos
Thanks for the patch, looks like a good start. From a cursory look:
- a few whitespace glitches in trac/web/chrome.py
- about know_users cached property:
- you don't need to give an explicit id when caching a property in a Component class (see apidoc:api/trac_cache#trac.cache.cached)
- s/tupel/tuple/, no need to describe the usage, it's a cached property
- just use self.known_users no need for self._user_map (it's even wrong to do so, at the latter will never get invalidated, once set)
- speaking of invalidation, this known_users property never gets invalidated, and this should at least be done in some session management operations (that's actually the difficult part and why further changes are needed until we can commit something like this)
comment:30 Changed 2 years ago by osimons
- Cc osimons added
comment:31 Changed 2 years ago by shoffmann
- Cc shoffmann added
comment:32 in reply to: ↑ 29 Changed 2 years ago by Poly <polyflor@…>
Replying to cboos:
From a cursory look:
- a few whitespace glitches in trac/web/chrome.py
- about know_users cached property:
[…] Thanks for setting the right stage for the cached attribute. I addressed your tips in the r3-0.12.2 patch.
- speaking of invalidation, this known_users property never gets invalidated, and this should at least be done in some session management operations (that's actually the difficult part and why further changes are needed until we can commit something like this)
I'd like to fix that too. I had a glance look in trac/web/session.py. I am not sure if this is the right (and the only) place to hook in the invalidation. This topic really needs more attention and time than I currently can provide. Some hints (if I am on the right track) could accelerate a solution for this. Thank you!
comment:33 Changed 22 months ago by lkraav <leho@…>
- Cc leho@… removed
comment:34 Changed 22 months ago by lkraav <leho@…>
- Cc leho@… added
comment:35 Changed 22 months ago by taylor@…
- Cc taylor@… added
comment:36 Changed 22 months ago by Martin Přikryl <martin.prikryl@…>
- Cc martin.prikryl@… added
comment:37 Changed 20 months ago by Anton Bobov <bobov_a@…>
- Cc bobov_a@… added
comment:38 Changed 17 months ago by haircut@…
- Cc haircut@… added
comment:39 Changed 17 months ago by framay <franz.mayer@…>
- Cc franz.mayer@… added
comment:40 Changed 16 months ago by krigstask <sterkrig@…>
- Cc sterkrig@… added
comment:41 Changed 16 months ago by dserodio@…
- Cc dserodio@… removed
comment:42 in reply to: ↑ 3 ; follow-up: ↓ 43 Changed 16 months ago by framay <franz.mayer@…>
Replying to cboos:
This looks interesting, but calling env.get_known_users is costly.
I am wondering, why Trac does not have any user table. A select * from user for example wouldn't probably that costly like env.get_known_users. Is there any ticket / request for a separate user table?
Furthermore all master data of users could be stored in that table, such as:
- name and forename (like already stored in session_attribute)
- email address (like already stored in session_attribute)
- phone number(s)
- room number
- location (address)
- department
- some more personell information about that person (knowledge, photo, etc.)
- etc.
Preference data could be stored as now in session_attribute.
comment:43 in reply to: ↑ 42 Changed 16 months ago by lkraav <leho@…>
Replying to framay <franz.mayer@…>:
Replying to cboos:
This looks interesting, but calling env.get_known_users is costly.
I am wondering, why Trac does not have any user table. A select * from user for example wouldn't probably that costly like env.get_known_users. Is there any ticket / request for a separate user table?
#2456 is an all-time classic :>
Changed 13 months ago by Hans-Peter Locher <locher.hanspeter@…>
improved (rev3 + invalidation of cached known_users) patch for 0.12.2
comment:44 follow-ups: ↓ 45 ↓ 52 Changed 13 months ago by Hans-Peter Locher <locher.hanspeter@…>
I've attached a new patch for Trac 12.2 with invalidation of the trac.web.chrome.Chrome.known_users
The invalidation works when changing the user attributes via trac-admin and when a user saves his prefs
comment:45 in reply to: ↑ 44 ; follow-up: ↓ 56 Changed 13 months ago by Hans-Peter Locher <locher.hanspeter@…>
comment:46 Changed 13 months ago by Hans-Peter Locher <locher.hanspeter@…>
- Cc locher.hanspeter@… added
comment:47 Changed 12 months ago by mhait@…
I`ve downloaded http://download.edgewall.org/trac/Trac-0.12.2.zip and failed to apply patch onto it (source code from Trac-0.12.2.zip really differs from patch version). What am I doing wrong?
comment:48 Changed 12 months ago by Boris Savelev <boris.savelev@…>
- Cc boris.savelev@… added
comment:49 Changed 12 months ago by jan.zilka@…
I upgraded Trac 0.12 patched by r3 to 0.13dev and show_full_names does not work.
All seems ok, lines from patch are in the 0.13 code. Any idea?
comment:50 Changed 12 months ago by anonymous
Patch works for 0.12.3, too :).
comment:51 Changed 11 months ago by Ryan J Ollos <ryano@…>
- Cc ryano@… added
comment:52 in reply to: ↑ 44 ; follow-up: ↓ 53 Changed 11 months ago by anonymous
Replying to Hans-Peter Locher <locher.hanspeter@…>:
I've attached a new patch for Trac 12.2 with invalidation of the trac.web.chrome.Chrome.known_users
The invalidation works when changing the user attributes via trac-admin and when a user saves his prefs
i'm using this patch but having an issue with email addresses
trac.ini is set to
show_email_addresses = false show_full_names = true
but full_names and email_addresses are both shown
show_email_addresses
appears to have no effect on my install (Trac 12.2.2, r4 patch)
am i missing a configuration trick? I would like full_name but no email to be displayed
comment:53 in reply to: ↑ 52 Changed 11 months ago by Ryan J Ollos <ryano@…>
Replying to anonymous:
am i missing a configuration trick? I would like full_name but no email to be displayed
I'm not entirely sure these will have an effect in this case, but you should probably make sure your users don't have the EMAIL_VIEW permission, and that never_obfuscate_mailto is True.
comment:54 follow-up: ↓ 57 Changed 10 months ago by jaz
how about patch for 1.0 dev version? I have created one for 0.13 . I'd work on 1.0 but have no access to svn…
comment:55 Changed 7 months ago by benco@…
- Cc benco@… added
comment:56 in reply to: ↑ 45 Changed 4 months ago by rainer.hihn@…
Replying to Hans-Peter Locher <locher.hanspeter@…>:
I extended the patch so that the Options in the <select> are sorted alphabetically by their Full Names.
http://trac.edgewall.org/attachment/ticket/7339/Trac-show_full_names-sorted-r4-0.12.2.patch
comment:57 in reply to: ↑ 54 Changed 4 months ago by Chris.Nelson@…
Replying to jaz:
how about patch for 1.0 dev version? I have created one for 0.13 . I'd work on 1.0 but have no access to svn…
How about just rolling this into the core? Is it controversial?
comment:58 Changed 4 months ago by cboos
Last patch looks worth testing, but it would need to be ported to at least 1.0-stable first. If so, we'll review it more closely, test it (from the comments, I'm not sure if the problem mentioned in comment:52 was addressed), and it could possibly make it for 1.0.2.
comment:59 Changed 3 months ago by djones@…
- Cc djones@… added
The -sorted version is very welcome, since our userids to not sort in the same order as last names.
Would love to see this rolled to core. I am planning to move from 0.12 to 1.0, but do not want to lose the real-names functionality.
comment:60 Changed 3 months ago by alexander.papaspyrou@…
- Cc alexander.papaspyrou@… added
comment:61 Changed 3 months ago by alexander.papaspyrou@…
- Cc alexander.papaspyrou@… removed
comment:62 Changed 3 months ago by alexander.papaspyrou@…
- Cc alexander.papaspyrou@… removed
comment:63 Changed 3 months ago by arkinform@…
- Cc arkinform@… added
comment:64 Changed 3 months ago by haircut@…
- Cc haircut@… removed
comment:65 Changed 3 months ago by ober.sebastian@…
- Cc ober.sebastian@… added
comment:66 Changed 2 months ago by fcorreia@…
- Cc fcorreia@… added



I'm definitely +1 for this.