Change site's owner (customer)

Discussion in 'General' started by Hellbound, Oct 3, 2005.

  1. Hellbound

    Hellbound New Member

    hi guys
    how can I change the already made site from one customer to another customer?

  2. falko

    falko Super Moderator Howtoforge Staff

    That's not possible yet.
    You have to delete the site (also from the recycle bin) and re-create it under the other customer.
  3. Hellbound

    Hellbound New Member

    how about modify it directly in mysql? which records? because recreating 15 sites it is really headache
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Modifying in mySQL is not easy and i think you will get errors when you do it manually. You would have to change the user and group ID's in the tables isp_nodes, isp_dep for the record of the website in the table isp_isp_web and for the users in isp_isp_user. The table relations are trough the doc_id and doctype_id.
  5. Hellbound

    Hellbound New Member

    I'll try to make a backup and change it so at least I can go back to previous settings
  6. bio

    bio New Member

    I am looking to do the same thing.

    I noticed that the previous reply was some time ago... is there an easier way yet?

    I am quite comfortable in the database making modifications, but want to make sure I get everything correct (as I have 50 domains on my box and I'd hate to hose it all up).

    Thanks in advance!

    On a alternative note: if I delete the domain to recreate it, will it also delete the user's email and web files? If not, that will work too.
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Its nearly impossible to change an owner for a larger site or it takes at least some time and its error prone.

    Here are some general informations but that does not mean that i recommend it ;)

    1) Get the userid and groupid of the customer. The easiest way is, create a new website for the customer and check which user and groupid it has.

    The user and groupid are in the table isp_nodes. you can join isp_nodes and isp_isp_web by their doc and doctype id's.

    2) To change the owner, you must set the userid and groupid in isp_nodes for the website to the new owner.

    Then you must do the smae things for all users from isp_isp_user and isp_isp_domain. The user and groupid for these tables are also in isp_dep.

    3) Get the corresponding records in the table isp_dep, where the parent_doc_id is the doc_id of the web and the parent_doctype_id is the doctype_id of the web. Change userid and groupid in isp_dep too.

    As you can see, changing userid's in 2 - 3 depending tables for each record is a pain :(

    No, all users and of a website where deleted recursively.
  8. cvladan

    cvladan New Member

    Tell me if I am wrong? Have I forgot something?

    I just changed the owner of the site... :cool:

    My notes - Changing the customer of already created site:

    1) Therefore, I titled the new site on the selected customer to '';

    SELECT * FROM `isp_nodes` AS a
    JOIN `isp_isp_web` AS b ON a.doc_id = b.doc_id AND a.doctype_id = b.doctype_id
    WHERE a.title = ''

    So, now I know the wanted user/groupid
    userid = 6, and groupid = 2
    2) Change the owner for the website (table isp_nodes).
    SELECT * FROM `isp_nodes` AS a WHERE a.title = ''
    (found that doc_id = 19 and doctype_id = 1013)
    Update is below in one sql command.

    Change the users (table isp_isp_user).
    SELECT * FROM `isp_isp_user` AS a WHERE a.user_username LIKE 'wantedsite.com_%'
    (found that i have two users: doc_id = 48 and doctype_id = 1014
    doc_id = 51 and doctype_id = 1014)
    Update is below in one sql command.
    And the same for domains (table isp_isp_domain):

    SELECT * FROM `isp_isp_domain` AS a WHERE a.domain_domain = ''
    (found that doc_id = 22 and doctype_id = 1015)

    Update is below in one sql command.

    Now check for dependecies:
    website: SELECT * FROM `isp_nodes` WHERE doc_id = 19 AND doctype_id = 1013
    users: SELECT * FROM `isp_nodes` WHERE doc_id IN (48,51) AND doctype_id = 1014
    domains: SELECT * FROM `isp_nodes` WHERE doc_id = 22 AND doctype_id = 1015
    And update everything:

    UPDATE `isp_nodes` SET userid = 6, groupid = 2 WHERE
    (doc_id = 19 and doctype_id = 1013) OR
    (doc_id IN (48,51) AND doctype_id = 1014) OR
    (doc_id = 22 AND doctype_id = 1015)

    3) Show everything: SELECT * FROM `isp_dep` WHERE parent_doc_id = 19 AND parent_doctype_id = 1013
    and i found out that I have and database: id = 15, doctype_id = 1029

    Do not do this: UPDATE `isp_dep` SET userid = xxx WHERE parent_doc_id = xxxx
    But no! This seems that has no effect! So revert... Do nothing in this table, considering the userid or groupid.

    At last, I found it:
    You must change the parent tree_id (easiest from hover on ispconfig tree) and doc_id (from table isp_isp_kunde):

    SELECT * FROM `isp_dep` WHERE child_doc_id = 19 AND child_doctype_id = 1013
    UPDATE `isp_dep` SET parent_doc_id = 4, parent_tree_id = 158 WHERE child_doc_id = 19 AND child_doctype_id = 1013

    The problems and dilemas are:

    Have I forgotten something? That will pop-up as a problem later?
    Are there any changes needed in 'dns_nodes' or 'dns_dep' tables?
    Nothing else to change?

    NOTE: Site names, or any other data here shown is fictional (but has sense)
    Last edited: Sep 26, 2007
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Why dont you do not use the site owner changing functionl which is available in the tools menu on all current ISPConfig versions?
  10. cvladan

    cvladan New Member

    C'mon guys!

    I just tought that I am stupid... :confused:
    But it's more - the naming of a tool is INCREDIBLE! :eek:

    I'am not MOVING SITE anywhere, just CHANGING OWNER.

    This is why I did not try this function, ever!
    Specially because it is in steps, and I never had a courage to go to step two!

    But, for everybody:

    Tools -> Move Websites
    Tools -> Change Ownership

    100% percent perfect! Just write a little more intuitive interfaces... :rolleyes:
  11. hairydog2

    hairydog2 New Member

    I want to move a site that was accidentally set up without being assigned to a client.

    The Move Websites page shows it as not belonging to an a client, but it won't offer me any clients in the drop-down list of clients to transfer it to.

    Any suggestions?
  12. falko

    falko Super Moderator Howtoforge Staff

    How did you manage to set up a web site without a client? :confused: That should not be possible. Maybe something's wrong with your database...
  13. hairydog2

    hairydog2 New Member

    I have no idea. There is a client, but the site is not associated with him. I thought it had belonged to the client, but it seems not to now. The website is really not important: only a simple holding page. They only use the domain name for email.

    I wondered if it would make sense to remove the codomain (there are two domain names) and add that as a site for the client, then make the existing site a codomain of that. But how can I copy any mail across without losing it?
  14. falko

    falko Super Moderator Howtoforge Staff

    You can't... :(
  15. tensor

    tensor New Member

    Is it possible to move the Customer, Sites or DNS zones between resellers?
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    Yes. Just change the reseller in the settings of the site or dns zoine and click on save :)
  17. LumpyOne

    LumpyOne New Member

    Tools menu?

    Hmmm. I'm running version 2.2.1.
    In my tools menu, I don't see this option.
    Will upgrading to the latest version make this option appear?

  18. till

    till Super Moderator Staff Member ISPConfig Developer

    Please update your ISPConfig to a current version.

Share This Page