Am adding the 'steps which will lead to error' with eg. below
0.I Set the module to 'take user to his subdomain on login'
1.The module created the subdomain(SD) guru.mysite.com for guru.
2.I changed username from 'guru' to guru2.
3.After tat,I created a new account with username 'guru' itself.
4.the module again asked 'do you like to create a Personal website as guru.mysite.com ?' and i clicked yes.
is nt that a bug considering guru.mysite.com already exists?

5.though the module asked thus,when i clicked yes ... it showed a warning

* The subdomain value must be unique.
* The site name value must be unique.

in red box .But just below it also showed in green box

* Your personal URL is http://guru.mysite.com/.
* The changes have been saved.

So it accepted the overlap .i confirmed it by on logging out and logging in again as guru and i was taken to the same SD guru.mysite.com.

So now guru2 and the new guru will be hving the same subdomain-guru.mysite.com.
Is this a bug and is there a way to set things right?

CommentFileSizeAuthor
#8 domain_username.patch1.25 KBagentrickard

Comments

agentrickard’s picture

Component: Code » - Domain User

So the bug here is that the subdomain value needs to change when the username changes.

We would need to account for that in hook_user($op = 'update').

http://api.drupal.org/api/function/hook_user

nirvanajyothi’s picture

hii rickard...sorry,
i dont underastand code.But is there anything i can do to improve the situation?
this bug needs to be solved for domain user cos it may cause confusion to users if the situation arises,rite?

agentrickard’s picture

There has to be something fixed at the code level.

Either that or you disable the ability to change usernames.

nirvanajyothi’s picture

ok...will wait for the code change...(users normally will like to change usernames a few times before they finally settle on one.)

agentrickard’s picture

Not a problem. Note #1 is really a reminder to me (or anyone else who wants to try this fix).

nirvanajyothi’s picture

ok.
To the 'access rules' in drupal the subdomains i created (by 'create domain record') are listed with
access type:deny
rule type :username
mask :subdomain.example.com
while the subdomains created by users with 'Domain User' are not listed here.

I wonder whether this has anything to do with this bug.

agentrickard’s picture

No. That is the correct behavior.

Think of it this way, if you have multiple domains set up and then allow user-based domains, your administrative domains are more valuable and should be protected.

Look at the problem:

- You create a domain for 'guru.example.com' using 'create domain record'
- This is obviously a domain that is central to your site, and should be available to all users.
- If a user tries to register the username 'guru', then Domain User would try to create a record for 'guru.example.com' -- which already exists as a privileged domain record.

In this case, we have two options:

1. Register the user's domain as 'guru2.example.com' -- which is a bad solution for two reasons:
-- It is not the behavior that the user expects.
-- It requires us to do extra calculation when creating user domains.

2. Ban usernames that match 'privileged' domains.

The issue is not with the usernames -- Drupal already prevents two users from sharing a single username. The issue is that we don't update the Domain User record in the event that a user changes their username.

agentrickard’s picture

Status: Active » Needs review
StatusFileSize
new1.25 KB

Patch that addresses the core issue.

Apply from the root 'domain' directory.

nirvanajyothi’s picture

thank you for making the patch rickard.

sorry to say this,i dont know how to apply a patch ...but i suppose is meant to patch domain module and not drupal core....can you give me a link to learn it easily...have not succeded with the drupals patch apply help and the video...didnt quite understand them...so please give me some time to learn it...will report ASAP

-Thank you

agentrickard’s picture

http://drupal.org/patch/apply

In this case, copy the patch file into the domain module directory on your server.

Then (using the command line) navigate to that directory.

Then type:

patch -p0 < domain_username.patch

And hit [enter] or [return].

nirvanajyothi’s picture

by server you mean my hosting account? and how do i get a command line on my server?

also i have downloaded UnxUtils ...on unzipping i found many folders of which one is called patch...

agentrickard’s picture

I cannot answer that. You would need to ask your host.

Otherwise, FTP the files to your local machine, and edit the file by hand. Then re-upload the changes.

In this case, it is only adding a few lines to the end of domain_user_user() in domain_user.module.

Typically, we do all patch testing on test servers. So it would be best not to apply the patch to your live site.

nirvanajyothi’s picture

ok.i do have a localhost setup for drupal...but dont have domain access running on it.

i will wait till the release of Domain Access with this change

-thank you rickard.

agentrickard’s picture

Status: Needs review » Fixed

Committed to HEAD and to 5-dev.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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