User creating

Discussion in 'Developers' Forum' started by shoevring, Jul 23, 2010.

  1. shoevring

    shoevring New Member

    Hello,

    I just looking at the creating but i have some questions about it..

    When i create a user, it insert the user into sys_user and sys_group via my php query..

    That is the next step? I want to create a user in "client" also, so i can make the limits and insert the firstname osv.

    How do i do that?
     
  2. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Just use the client_add function from the remote API. Do not add anything manually in sys_user or sys_group as this is all handled by the client_add.

    function client_add($session_id, $reseller_id, $params);

    $params is an array. Like in all functions of the API, the keys of this array are identical to the fields of the corresponding database table. In this case, the client table. The sys_* database fields are for ispconfigs internal use and do not go into $params.

    You find all available functions in the remoting.inc.php file.
     
  3. shoevring

    shoevring New Member

    Hmm, I dont think i can do it without help..

    Can i setup the whole client with one script? Like, username, firstname, default webserver, limits all things?

    -------------------------------------------------------------------

    If i have these variables:

    $username
    $password
    $firstname
    $contactperson
    $street
    $streetnumber
    $zipcode
    $city
    $startmodule
    $modules
    $language
    $email
    $telephone
    $default_mailserver
    $default_webserver
    $default_dbserver
    --- ALLE LIMITS ---
    -------------------------------------------
    With the information from the top on the line, how do i create a user?

    I think there is more than one user in here there want this help too..

    I hope you can help me.. thanks.
     
  4. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    Sure, why not? Thats the purpose of this function.

    First, take a look at the client table in the database to get all available fields:

    Code:
    `company_name` varchar(64) default NULL,
      `contact_name` varchar(64) default NULL,
      `street` varchar(255) default NULL,
      `zip` varchar(32) default NULL,
      `city` varchar(64) default NULL,
      `state` varchar(32) default NULL,
      `country` char(2) default NULL,
      `telephone` varchar(32) default NULL,
      `mobile` varchar(32) default NULL,
      `fax` varchar(32) default NULL,
      `email` varchar(255) default NULL,
      `internet` varchar(255) NOT NULL,
      `icq` varchar(16) default NULL,
      `notes` text,
      `default_mailserver` int(11) unsigned NOT NULL default '1',
      `limit_maildomain` int(11) NOT NULL default '-1',
      `limit_mailbox` int(11) NOT NULL default '-1',
      `limit_mailalias` int(11) NOT NULL default '-1',
      `limit_mailaliasdomain` int(11) NOT NULL default '-1',
      `limit_mailforward` int(11) NOT NULL default '-1',
      `limit_mailcatchall` int(11) NOT NULL default '-1',
      `limit_mailrouting` int(11) NOT NULL default '0',
      `limit_mailfilter` int(11) NOT NULL default '-1',
      `limit_fetchmail` int(11) NOT NULL default '-1',
      `limit_mailquota` int(11) NOT NULL default '-1',
      `limit_spamfilter_wblist` int(11) NOT NULL default '0',
      `limit_spamfilter_user` int(11) NOT NULL default '0',
      `limit_spamfilter_policy` int(11) NOT NULL default '0',
      `default_webserver` int(11) unsigned NOT NULL default '1',
      `limit_web_ip` text,
      `limit_web_domain` int(11) NOT NULL default '-1',
      `limit_web_quota` int(11) NOT NULL default '-1',
      `web_php_options` varchar(255) NOT NULL default 'no,fast-cgi,cgi,mod,suphp',
      `limit_web_subdomain` int(11) NOT NULL default '-1',
      `limit_web_aliasdomain` int(11) NOT NULL default '-1',
      `limit_ftp_user` int(11) NOT NULL default '-1',
      `limit_shell_user` int(11) NOT NULL default '0',
      `ssh_chroot` varchar(255) NOT NULL DEFAULT 'no,jailkit,ssh-chroot',
      `limit_webdav_user` int(11) NOT NULL default '0',
      `default_dnsserver` int(11) unsigned NOT NULL default '1',
      `limit_dns_zone` int(11) NOT NULL default '-1',
      `limit_dns_slave_zone` int(11) NOT NULL default '-1',
      `limit_dns_record` int(11) NOT NULL default '-1',
      `default_dbserver` int(11) NOT NULL default '1',
      `limit_database` int(11) NOT NULL default '-1',
      `limit_cron` int(11) NOT NULL default '0',
      `limit_cron_type` enum('url','chrooted','full') NOT NULL default 'url',
      `limit_cron_frequency` int(11) NOT NULL default '5',
      `limit_traffic_quota` int(11) NOT NULL default '-1',
      `limit_client` int(11) NOT NULL default '0',
      `parent_client_id` int(11) unsigned NOT NULL default '0',
      `username` varchar(64) default NULL,
      `password` varchar(64) default NULL,
      `language` char(2) NOT NULL default 'en',
      `usertheme` varchar(32) NOT NULL default 'default',
    Then create your params array:

    Code:
    $params = array('contact_name' => $firstname.' '.$lastname, 'username' => $username, 'password' => $password, .................);
    and so on.

    and then call the remote function:

    Code:
    $client->client_add($session_id, 0, $params);
     
  5. shoevring

    shoevring New Member


    So, something like this(How should the default server be in the variable? With the id of the server?):


    <?php

    [my variables]

    include "/usr/local/ispconfig/interface/lib/classes/remoting.inc.php";

    $params = array('contact_name' => $firstname.' '.$lastname,'username' => $username,'password' => $password,'street' => $street.' '.$streetnumber,'zip' => $zipcode,'email' => $email,'default_mailserver' => $mailserver,'default_webserver' => $webserver,'default_dbserver' => $dbserver,'limit_maildomain' => $limit_maildomain,'limit_mailbox' => $limit_mailbox,'limit_mailalias' => $limit_mailalias,'limit_mailaliasdomain' => $limit_mailaliasdomain,'limit_mailforward' => $limit_mailforward,'limit_mailcatchall' => $limit_mailcatchall,'limit_mailrouting' => $limit_mailrouting,'limit_mailfilter' => $limit_mailfilter,'limit_fetchmail' => $limit_fetchmail,'limit_mailquota' => $limit_mailquota,'limit_spamfilter_wblist' => $limit_spamfilter_wblist,'limit_spamfilter_user' => $limit_spamfilter_user,'limit_spamfilter_policy' => $limit_spamfilter_policy,'limit_web_domain' => $limit_web_domain,'limit_web_quota' => $limit_web_quota,'limit_web_subdomain' => $limit_web_subdomain,'limit_web_aliasdomain' => $limit_web_aliasdomain,'limit_ftp_user' => $limit_ftp_user,'limit_shell_user' => $limit_shell_user,'limit_webdav_user' => $limit_webdav_user,'limit_database' => $limit_database,'limit_cron' => $limit_cron,'limit_cron_type' => $limit_cron_type,'limit_cron_frequency' => $limit_cron_frequency,'limit_traffic_quota' => $limit_traffic_quota,'language' => $defaultlanguage');


    $client->client_add($session_id, 0, $params);

    ?>

    ??? is this right?
     
  6. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    You dont ahve to include any files from ispconfig. This is a remote api, it uses the SOAP protocol over httpd. There are dozens of examples in the remote_client directory in the ispconfig that explain how to use it.
     
  7. shoevring

    shoevring New Member

    Allright, can you link to some of them?
     
  8. till

    till Super Moderator Howtoforge Staff HowtoForge Supporter ISPConfig Developer

    No, as they are inside the ispconfig tar.gz file.

    1) Downliad the ispconfig tar.gz file.
    2) unpack it waith tar.
    3) Look into the unpacked directories, there is just one directory named remoting_client and there rea dozens of examples inside.
     

Share This Page