HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Developers' Forum (http://www.howtoforge.com/forums/forumdisplay.php?f=33)
-   -   Change the domain user without using the panel (http://www.howtoforge.com/forums/showthread.php?t=54544)

matiasCU 15th October 2011 16:46

Change the domain user without using the panel
 
Hi People,
Massive change is possible with remote api-mail accounts? For example, change a user's maildir. Just as when you create a mailbox with the following function:

$params = array( 'server_id' => 1,
'name' => 'name of user1',
'email' => 'user1@domain.tld',
'password' => 'somepass',
'quota' => '0',
'maildir' => '/var/vmail/domain.tld/user1'
'homedir' => '/var/vmail','uid' => '5000',
'gid' => '5000',
'postfix' => 'y',
'disableimap' => '0',
'disablepop3' => '0');
$client_id = 0;
$domain_id = $client->mail_user_add($session_id,$client_id, $params);

What would happen if I just change by sql query maildir field value of a user? It would make the mailbox pass another location in /var/vmail/? For example, I need to change a user user1@domain1.tld user1@domain2.tld, as you might do this?

user1 maildir is /var/vmail/domain1.tld/user1 and need to be /var/vmail/domain2.tld/user1

Thanks.

till 17th October 2011 10:19

Quote:

What would happen if I just change by sql query maildir field value of a user?
It would break your system. Always use the remote API to do changes in the ispconfig db as all changes that you do directly in sql will not get processed by the server scripts.

But the function you posted above is wrong for that purpose as it will add a new user instaed of modifying a existing account. To modify existing accounts, use the update function.

For example in your case above, the direct change in the sql db will result in two mailboxes, a complete old one which is inaccessible and a partly created new one which misses functions like quota etc.

matiasCU 18th October 2011 01:28

Quote:

Originally Posted by till (Post 265483)
It would break your system. Always use the remote API to do changes in the ispconfig db as all changes that you do directly in sql will not get processed by the server scripts.

But the function you posted above is wrong for that purpose as it will add a new user instaed of modifying a existing account. To modify existing accounts, use the update function.

For example in your case above, the direct change in the sql db will result in two mailboxes, a complete old one which is inaccessible and a partly created new one which misses functions like quota etc.

Thank you very much Till, is what I figured why do you ask before.
Where to find documentation on the update function?

till 18th October 2011 08:20

The remote api documentation has been released as part of the current beta. You can find it in the beta tar.gz in the file in the remot_client sub directory:

http://www.howtoforge.com/forums/showthread.php?t=54370


All times are GMT +2. The time now is 12:03.

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