Remoting sys user

Discussion in 'Developers' Forum' started by Tommahawk, Aug 6, 2007.

  1. Tommahawk

    Tommahawk New Member

    Remoting framework is adding clients OK in isp_isp_kunde but it does not seem to be adding a sys_user. The code shows that it is the sys_user table that is queried when logging in. How can I have remoting add an entry in the sys_user table, is it a matter of adding an SQL command in a particular file or is their something I have missed?

    I believe that
    /home/admispconfig/ispconfig/lib/classes/ispconfig_kunde.lib.php
    function kunde_add($session,$params) {
    is what is called when adding a new client and their is no reference to sys_user there
    the only other place sys_user is referenced relative to my issue is in the
    /home/admispconfig/ispconfig/lib/classes/ispconfig_isp_kunde.lib.php file
    function kunde_insert($doc_id, $doctype_id, $die_on_error = '1') {

    Thanks in advance.
     
    Last edited: Aug 6, 2007
  2. Tommahawk

    Tommahawk New Member

    I fixed the issue so when a new client is added they can immediately login by adding this to file ispconfig_kunde.lib.php after aprox line 290


    //add a relative sys_user
    $userid = $go_info["user"]["userid"];

    $sql = "INSERT INTO sys_user (
    userid,
    username,
    passwort,
    gueltig,
    perms,
    modules,
    modul
    ) VALUES (
    '$userid',
    '".addslashes($params["webadmin_user"])."',
    '$passfmt1',
    '1',
    'rw',
    'isp_kunde,isp_file,tools,help',
    'isp_kunde'
    )";

    $go_api->db->query($sql);
    $userid = $go_api->db->insertID();

    $sql = "INSERT INTO sys_nodes (
    userid,
    groupid,
    parent,
    type,
    doctype_id,
    status,
    doc_id,
    title
    ) VALUES (
    '1',
    '0',
    '',
    'a',
    '1',
    '1',
    '$userid',
    ''
    )";

    $go_api->db->query($sql);


    I also added the following to same file when a new client is added

    $passfmt1 = md5($params["webadmin_passwort"]);
    $passfmt2 = "||||:".$passfmt1;


    I also noticed that the sys_user is not deleted at all.... hope it helps
     
    Last edited: Aug 6, 2007
  3. till

    till Super Moderator

    The File /home/admispconfig/ispconfig/lib/classes/ispconfig_isp_kunde.lib.php is called by the file /home/admispconfig/ispconfig/lib/classes/ispconfig_isp_kunde.lib.php and this worked some time ago. I added it to the bugtracker, maybe we changed something that made it incompatible with the remoting framework.
     
  4. Tommahawk

    Tommahawk New Member

    It then becomes impossible to assign a website to the client because the client is not sufficiently registered something to do with webadmin_userid variable (in isp_isp_kunde mysql table) being installed with a default value of 0, I am in the dark about where this number should come from or how I can generate it validly, any ideas Thanks in advance

    It seems when this number is unique the problem gets solved and sites can be allocated to the client, I will do some further tests...Now that leaves ISPConfig to cleanup the following mysql tables

    isp_isp_kunde
    isp_nodes
    sys_user
    sys_nodes
    and what exists already such as websites associated when a client gets deleted

    Thanks my issues are almost solved and I will post the remoting php script that adds users and sites while you sleep soon.
     
    Last edited: Aug 6, 2007
  5. Tommahawk

    Tommahawk New Member

    AFAIK

    Remoting code in file: /home/admispconfig/ispconfig/lib/classes/ispconfig_kunde.lib.php

    in current stable Version: 2.2.15 is missing

    1) sys_user creation procedure in sys_user table
    2) webadmin_userid generation procedure in isp_isp_kunde table where is webadmin_userid in the isp_isp_kunde table is the doc_id of the sys_user table for that same client

    The code fix resides in /home/admispconfig/ispconfig/lib/classes/ispconfig_isp_kunde.lib.php from line 86 to 106 copy and paste that after the kunde is created but looking for an official fix because their are some issues with syncing webadmin_userid <-> doc_id

    1) Is the code missing in previous versions?
    2) What is the fix?
     
    Last edited: Aug 15, 2007
  6. Tommahawk

    Tommahawk New Member

    Done fixed I will post my version of the lib file but someone who knows what is happening needs to look over it.

    I also have a paypal integrated script that adds 1 client, 1 user, 1 website via webpage. If ISPConfig want to make it available as a commercial addon let me know otherwise I will post it here...
     
  7. till

    till Super Moderator

    Afaik, you are wrong. There is nothing missing. You totally mix up different parts of the framework. There are no dupliacte functions as you posted in the feature requests thread.

    The sys_user is inserted automatically when you update the kunde record and provide the username and password. That is needed because the interface provides the username and password for the client on another tab and though it is checked and inserted in the update event and not on the insert event.

    What you are doing is duplicationg code and it is not a good idea to copy code around instead of reusing it by including the code as the current framework does it.
     

Share This Page