Closed (fixed)
Project:
Drupal core
Version:
4.7.0
Component:
user.module
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
1 Dec 2005 at 11:42 UTC
Updated:
7 Dec 2007 at 00:30 UTC
Jump to comment: Most recent file
This patch makes only selected users able to change their username
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | change_username_1.patch | 3.62 KB | Crell |
| #2 | change_username_0.patch | 2.02 KB | saerdna |
| change_username.patch | 2.46 KB | saerdna |
Comments
Comment #1
walkah commented+1 for the functionality! (not sure about the permission name).
Comment #2
saerdna commentedWith this patch, users who has the "change own username" flag can change their own username. users with administer users can still change own/others usernames.
What needs to be done on this patch?
Currently the patch only hides the form input. There need to be some check in the validation but im not sure how to make it. I dont want to mess the validate_name function because its supposed to validate the name not the access imo.
Also im not sure if people with "administer users" can change user with uid 1 username. this should not be possible. (it shouild not be possible to change the uid 1 user at all if you are not the one imo).
Would be great if someone can complete this.
Comment #3
rkerr commentedIn the _user_edit_validate function, I think you will have to wrap the section that validates the username (around line 1185 .. 1193 of user.module in the cvs tarball I just downloaded) with your access privileges check.
Such as:
Comment #4
Crell commentedI'll help with this, since I'm a big fan of more finely grained permissions. :-)
Yep, that's all that was needed. Here's an updated version that should be fully functional. I also got rid of the tab character in favor of the preferred double space.
Comment #5
saerdna commentedthanks crell!
im not used with all of the drupal codingstandards, ill config my editor for 2 spaces :-)
and the patch seems to work great!
i tried to make a form in a static html on the hardrive and post it to my drupalsandbox but it got denied :)
Comment #6
dries commentedCommitted to HEAD.
Comment #7
(not verified) commentedComment #8
panchoAdding version tag