HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   General (http://www.howtoforge.com/forums/forumdisplay.php?f=25)
-   -   Assign / Re-Assign existing client to a reseller (http://www.howtoforge.com/forums/showthread.php?t=57770)

ColdFire 28th June 2012 20:08

Assign / Re-Assign existing client to a reseller
 
Hello everybody,

I'm missing something would allow me to assign an existing customer with all of his "assets" (domains, email and website stuff) to a reseller

How may I achieve that ?

If not in the GUI can I handle that manually in the database?

till 29th June 2012 11:16

You can do that in the database only.

1) Edit the record of the client in the client table and set the field "parent_client_id" to the client_id of the reseller.

2) Then edit the the login user of the reseller in the "sys_user" table and add the groupid of the client (see sys_group for the id, you can look it up by using the client_id column) in the "groups" field, separated by ",".

cfoe 29th June 2012 13:07

maybe open a feature request on the bugtracker.
It seems like a feature that could come in handy for other users (me included) in the future.

cfoe 7th August 2012 12:15

vote here: http://bugtracker.ispconfig.org/inde...ls&task_id=926

pfaf 14th September 2012 23:15

Move client to another reseller: Not working exaclty as it should.
 
OK, it seems to work, but we cannot see the moved client under clients when we login with the new reseller. We can see the web site records under web sites. We can still see the clients that the new reseller has created.

Moreover, the reseller cannot delete the database that was created from the old reseller for the client. The old reseller is the admin user of ISPConfig, the one that was created during setup.

Any ideas?

Thank you in advance for your support.

Kind regards,

Panos.

Quote:

Originally Posted by till (Post 281341)
You can do that in the database only.

1) Edit the record of the client in the client table and set the field "parent_client_id" to the client_id of the reseller.

2) Then edit the the login user of the reseller in the "sys_user" table and add the groupid of the client (see sys_group for the id, you can look it up by using the client_id column) in the "groups" field, separated by ",".


pfaf 21st October 2012 18:02

Using the main administrator we have created a client under clients and a website which belongs to the client.

Later we created a reseller and want to assign the client and website under the reseller.

We followed
http://www.howtoforge.com/forums/showthread.php?t=55628
and assigned the website to the reseller. Then we should login with the reseller id and assign the website to the client.

We have followed the manual way of assigning a client created under the installation (main) user to a reseller we created later according to http://www.howtoforge.com/forums/showthread.php?t=57770.

When we login with the reseller id and we go to CLIENTS then we cannot see the client under clients. We can see the client when we edit the site but when we assign the the final client, the reseller has no more access the the website data.

Do we miss anything?
Quote:

Originally Posted by till (Post 281341)
You can do that in the database only.

1) Edit the record of the client in the client table and set the field "parent_client_id" to the client_id of the reseller.

2) Then edit the the login user of the reseller in the "sys_user" table and add the groupid of the client (see sys_group for the id, you can look it up by using the client_id column) in the "groups" field, separated by ",".


till 21st October 2012 18:33

The permission system in ispconfig is similar to the used in Linux for file permissions and consists of users and groups. Each client and reseller has a group in the sys_group table. To make a record visible to a reseller or client, the record must either have the userid of the client or reseller in the sys_user_id column or the groupid of the client or reseller in the sys_group_id column.

Please check that the group_id of the sys_group of the reseller is used in the sys_group_id column of the client that is not visible when you login as reseller.

pfaf 21st October 2012 23:16

Move a client under a different reseller
 
So, to summarize the steps in order for a Client to be moved under another Reseller :

1.Locate the following values for the Reseller under which you want to assign the client to.
R_userid: Search by 'username' in the 'sys_user' table and get column 'userid'
R_groupid: Search by 'name' in the 'sys_group' table and get column 'groupid'
R_client_id: Search by 'name' in the 'sys_group' table and get column 'client_id'

2. Locate the following values for the Client under which you want to assign the client to.
C_userid: Search by 'username' in the 'sys_user' table and get column 'userid'
C_groupid: Search by 'name' in the 'sys_group' table and get column 'groupid'
C_client_id: Search by 'name' in the 'sys_group' table and get column 'client_id'

3. Table 'client'
Locate the record of the client using C_client_id in column 'client_id' and modify the field 'parent_id' = R_client_id.
Also change column 'sys_userid' to R_userid and column 'sys_groupid' to R_groupid. This is done so that the reseller sees the clients under the clients page.

4. Table 'sys_user'
Locate the reseller record by using column 'username' or R_userid in column 'userid'. Modify the column 'groups' so that it contains also the C_group_id. This is done in order for the reseller to see the client websites.

I hope that the above will be of some help to others.

Kind regards to all,

Panos.

jvargas 25th October 2012 18:59

Thanks pfaf, I do confirm your hint works as expected.

Cheecoh 28th October 2013 01:16

Quote:

Originally Posted by pfaf (Post 287100)
So, to summarize the steps in order for a Client to be moved under another Reseller

Thank you very much for this! That helped me to move the user flawlessly!
I've created some mysql-queries to fetch and update the data.. Simply replace the values you've mentioned already!

Fetch relevant R_(userid|groupid|client_id) and C_(userid|groupid|client_id)
Code:

SELECT Rsu.userid AS R_userid, Rsg.groupid AS R_groupid, Rsg.client_id AS R_client_id, Csu.userid AS C_userid, Csg.groupid AS C_groupid, Csg.client_id AS C_client_id
FROM sys_user AS Rsu
        JOIN sys_group AS Rsg ON Rsu.default_group = Rsg.groupid
        JOIN sys_user AS Csu ON Csu.username = "CLIENT_USERNAME"
        JOIN sys_group AS Csg ON Csu.default_group = Csg.groupid
WHERE Rsu.username = "RESELLER_USERNAME";

UPDATE client and add reseller! (to see client in the reseller view)
Code:

UPDATE `client`
SET `parent_id` = "R_client_id",
        `sys_userid` = "R_userid",
        `sys_groupid` = "R_groupid"
WHERE client_id = "C_client_id";

UPDATE reseller to see client's websites (It was necessary to "re-auth/login" with the reseller account to see the clients websites)
Code:

UPDATE `sys_user`
        SET `groups` = CONCAT(`groups`,',','C_groupid')
WHERE `userid` = "R_userid";

Best Regards,

Chris


All times are GMT +2. The time now is 16:09.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.