Extended RemoteBridge plugin [UPDATE: 2014-11-30]

  • I´ve extended the RemoteBridge with the update user/domain function.


    This is NOT an official release.
    Feel free to test it and give feedback only here in this threat.


    action = 'update'


    you can use all settings from 'create'


    exception:
    if admin_pass is empty, the password for this user will not be changed.
    if you want to change the password, you have to set the new password in admin_pass


    here is the sample:


    PHP
    1. function dataEncryption($dataToEncrypt, $ResellerUsername) { return strtr(base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($ResellerUsername), serialize($dataToEncrypt), MCRYPT_MODE_CBC, md5(md5($ResellerUsername)))), '+/=', '-_,');}$bridgeKey = 'mYbRiDgEkEy';$ResellerUsername = 'res1';$dataToEncrypt = array( 'action' => 'update', 'reseller_username' => $ResellerUsername, 'reseller_password' => 'yxcvb123', 'bridge_key' => $bridgeKey, 'hosting_plan' => 'myhostingplan', 'email' => '[email protected]', 'fname' => 'Micky', 'lname' => 'Mouse', 'firm' => 'Disney Inc.', 'zip' => '23456', 'domain' => 'mydomain.de', 'admin_pass' => 'abc123');$ch = curl_init('http://admin.server.example.com/remotebridge.php');curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS, 'key='.$bridgeKey.'&data='.dataEncryption($dataToEncrypt, $ResellerUsername));curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);$httpResponse = curl_exec($ch);echo $httpResponse;curl_close($ch);


    If you want to test it with Git stable, please change version in imscp.conf to something > 1.1.2 (as soon as you are finished testing, change it back to Git stable)
    and use http://admin.server.example.com:8080/remotebridge.php as curl_init URL


    UPDATE:
    - add: get list of all users from a reseller

    Code
    1. $dataToEncrypt = array( 'action' => 'get_user', 'reseller_username' => $ResellerUsername, 'reseller_password' => 'mypass123', 'bridge_key' => $bridgeKey);


    result looks like this:

    Code
    1. {"level":"Success","message":"User list for reseller fisa4 successfully generated.","data":[{"admin_name":"green.xsws.de"},{"admin_name":"fisa5.de"},{"admin_name":"fisa6.de"}]}


    new action: get_user


    I´ve updated the file to latest version.

  • Why you don't create a pull request on github? :)

  • Edit: translated to english.


    First let me extend the RemoteBridge a little bit more. After that i try to find out how i have to work with github.

  • Oh shit I'm sry, my fault :D I'll translate my posts *gg*

  • Initial post updated.
    New action: addmail


    Code sample:


    available settings:
    account type can be
    - normal_mail
    - normal_forward
    - normal_mail,normal_forward


    quota value is in MB
    if normal_forward is set, at least one forward address has to be set in mail_forward.
    more then one mailaddress in mail_forward has to be seperated by commas.
    i.e. '[email protected],[email protected]'


    Currently the function will not check the max. available quota and max. amount of mail addresses.


    Comming up next: (in order of development)
    - add the max. quota and max. mailaddresses checking.
    - add catchall and autoresponder
    - edit and delete of mailaccounts (edit means: change account type, quota and password like in the panel)


    Greets


    FISA4

  • Updated again.
    - Add: forwarding mailaddress is now required if mail_type is 'normal_forward' or 'normal_mail,normal_forward'
    - Add: check max. mailaccounts
    - Add: check max. quota for this domain


    Next update needs some day. ;)


    It would be nice if a Dev could have a look at the code. Maybe it could be improved. :)