Api, what am i doing wrong

Discussion in 'Developers' Forum' started by Steffan, Feb 3, 2020.

  1. Steffan

    Steffan Member

    yes it should be me doing soemthing stupid but i cant find it.
    Update reseller
    if i do
    Code:
    $client->client_get_by_customer_no
    im getting the result...
    Code:
     [limit_traffic_quota] => -1
    [limit_client] => 100
    [limit_mailmailinglist] => -1
    etc etc

    But im getting a soap error
    Code:
    SOAP Error: Reseller cannot be client of another reseller.
    if i look at the code below i understand that it wants limit_client to be 0??
    Code:
     
        if($params['parent_client_id']) {
                // check if this one is reseller
                $check = $app->db->queryOneRecord('SELECT `limit_client` FROM `client` WHERE `client_id` = ?', intval($params['parent_client_id']));
                if($check['limit_client'] == 0) {
                    throw new SoapFault('Invalid reseller', 'Selected client is not a reseller.');
                    return false;
                }
                if(isset($params['limit_client']) && $params['limit_client'] != 0) {
                    throw new SoapFault('Invalid reseller', 'Reseller cannot be client of another reseller.');
                    return false;
                }
            }
    
    please tell me what the mistake i made?
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    A client must have client_limit = 0, if client_limit > 0, then its a reseller and not a client. As the error message tells you, a reseller can not be the client of another reseller or in other words, a reseller can have clients as sub-records but a reseller can never have another reseller as sub-record.
     
  3. Steffan

    Steffan Member

    So somehow i mixup the data for the soap. Will debug it.

    Is it correct that the SOAP does not have a function to compare the password of a client.
    I like to use the clients login for another website so they only have one username and pass.

    In the passed i used to use
    f(crypt(stripslashes($passwd), $salt) == $saved_password) {

    But ispconfig has changed the way the passowrds are generated...
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    There is no api function to verify a password, you have to fetch the whole client record with the get method and compare it yourself. ISPConfig just uses a more secure encryption type of the crypt command now, so you can verify it with crypt. Have a look into the ispconfig auth lib or login script to see how ISPconfid verifies it.
     

Share This Page