sys_userid field

Discussion in 'Developers' Forum' started by devalentino, Jul 5, 2012.

  1. devalentino

    devalentino New Member

    Hi

    I write module for drupal, which works with IPSConf 3 SOAP API.
    I try to get user's sites with function client_get_sites_by_user.

    at first I receive user data:
    PHP:
    $i3Client $client->client_get($sessionId$clientId);
    here is $i3Client var_dump:
    Code:
    array (size=72)
      'client_id' => string '2' (length=1)
      'sys_userid' => string '1' (length=1)
      'sys_groupid' => string '1' (length=1)
      'sys_perm_user' => string 'riud' (length=4)
      'sys_perm_group' => string 'riud' (length=4)
      'sys_perm_other' => string '' (length=0)
      'company_name' => string '' (length=0)
      'company_id' => string '' (length=0)
      'contact_name' => string 'Protog Client 1' (length=15)
      'customer_no' => string '' (length=0)
      'vat_id' => string '' (length=0)
      'street' => string '' (length=0)
      'zip' => string '' (length=0)
      'city' => string '' (length=0)
      'state' => string '' (length=0)
      'country' => string 'UA' (length=2)
      'telephone' => string '' (length=0)
      'mobile' => string '' (length=0)
      'fax' => string '' (length=0)
      'email' => string '' (length=0)
      'internet' => string '' (length=0)
      'icq' => string '' (length=0)
      'notes' => string '' (length=0)
      'default_mailserver' => string '0' (length=1)
      'limit_maildomain' => string '0' (length=1)
      'limit_mailbox' => string '0' (length=1)
      'limit_mailalias' => string '0' (length=1)
      'limit_mailaliasdomain' => string '0' (length=1)
      'limit_mailforward' => string '0' (length=1)
      'limit_mailcatchall' => string '0' (length=1)
      'limit_mailrouting' => string '0' (length=1)
      'limit_mailfilter' => string '0' (length=1)
      'limit_fetchmail' => string '0' (length=1)
      'limit_mailquota' => string '0' (length=1)
      'limit_spamfilter_wblist' => string '0' (length=1)
      'limit_spamfilter_user' => string '0' (length=1)
      'limit_spamfilter_policy' => string '0' (length=1)
      'default_webserver' => string '0' (length=1)
      'limit_web_ip' => null
      'limit_web_domain' => string '0' (length=1)
      'limit_web_quota' => string '0' (length=1)
      'web_php_options' => string 'no,fast-cgi,cgi,mod,suphp' (length=25)
      'limit_web_subdomain' => string '0' (length=1)
      'limit_web_aliasdomain' => string '0' (length=1)
      'limit_ftp_user' => string '0' (length=1)
      'limit_shell_user' => string '0' (length=1)
      'ssh_chroot' => string 'no,jailkit,ssh-chroot' (length=21)
      'limit_webdav_user' => string '0' (length=1)
      'default_dnsserver' => string '0' (length=1)
      'limit_dns_zone' => string '0' (length=1)
      'limit_dns_slave_zone' => string '0' (length=1)
      'limit_dns_record' => string '0' (length=1)
      'default_dbserver' => string '0' (length=1)
      'limit_database' => string '0' (length=1)
      'limit_cron' => string '0' (length=1)
      'limit_cron_type' => string '' (length=0)
      'limit_cron_frequency' => string '0' (length=1)
      'limit_traffic_quota' => string '0' (length=1)
      'limit_client' => string '0' (length=1)
      'limit_mailmailinglist' => string '0' (length=1)
      'limit_openvz_vm' => string '0' (length=1)
      'limit_openvz_vm_template_id' => string '0' (length=1)
      'parent_client_id' => string '0' (length=1)
      'username' => string 'pclient1' (length=8)
      'password' => string '$1$9aHgTWaB$YkoOqK93E8hJmjTTB/TrA.' (length=34)
      'language' => string 'fi' (length=2)
      'usertheme' => string 'default_no_navimg' (length=17)
      'template_master' => string '0' (length=1)
      'template_additional' => string '' (length=0)
      'created_at' => string '1341391516' (length=10)
      'id_rsa' => string '-----BEGIN RSA PRIVATE KEY-----
    MIIEpQIBAAKCAQEAvvKYFoNmovv86oAFUDg1MgxdmPFz3Xch69pO21gJu4xVuAGD
    ooZOURxX0qAxAD90QWDvOTgr50U4jiax9jpe57NCOukgQHvldQmBELC8Gb/YV91M
    8S8SUgUbSbCHbZnGNmp1RS2IAQ+C4WHB/ZYiujjmUEVIY3ll3WtazrpvkFohaKw0
    pGPyGa26d6hfEaL0mR+F9zVabaZWNkugSstW3p+QqaldE3qQU5RQUU3yvZD7gRuD
    LiVLLkhw1iHJUgg8juMVM8KOIAyc8q8hYIOhUj7LlFQXnpKtudxZn1Ir6pjz4oc5
    YiSnDU4910+CWvaNEwua1gu+882cXO/RUl6kVwIDAQABAoIBAQCykhrrSv1sRK40
    +358k+Qjpu7NPlj17xiZAfMnLAEGFOqBB2F8V4/cSN5Uypyot67YCXgPEdn1EYYf
    Yk6hj9r7Ymf4wdX4mCVxO28pF'... (length=1679)
      'ssh_rsa' => string 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+8pgWg2ai+/zqgAVQODUyDF2Y8XPddyHr2k7bWAm7jFW4AYOihk5RHFfSoDEAP3RBYO85OCvnRTiOJrH2Ol7ns0I66SBAe+V1CYEQsLwZv9hX3UzxLxJSBRtJsIdtmcY2anVFLYgBD4LhYcH9liK6OOZQRUhjeWXda1rOum+QWiForDSkY/IZrbp3qF8RovSZH4X3NVptplY2S6BKy1ben5CpqV0TepBTlFBRTfK9kPuBG4MuJUsuSHDWIclSCDyO4xUzwo4gDJzyryFgg6FSPsuUVBeekq253FmfUivqmPPihzliJKcNTj3XT4Ja9o0TC5rWC77zzZxc79FSXqRX pclient1-rsa-key-1341391516
    ' (length=409)
    
    then I try to receive user's sites:
    PHP:
    $sites $client->client_get_sites_by_user(
                
    $sessionId
                
    $i3Client["sys_userid"], 
                
    $i3Client["sys_groupid"]);
    here is $sites var_dump:
    Code:
    array (size=1)
      0 => 
        array (size=4)
          'domain' => string 'test1.net' (length=9)
          'domain_id' => string '1' (length=1)
          'document_root' => string '/var/www/clients/client1/web1' (length=29)
          'active' => string 'y' (length=1)
    
    | connected to server and saw client table:
    Code:
    mysql> select client_id, sys_userid, sys_groupid, username from client;
    +-----------+------------+-------------+----------+
    | client_id | sys_userid | sys_groupid | username |
    +-----------+------------+-------------+----------+
    |         1 |          1 |           1 | test1    |
    |         2 |          1 |           1 | pclient1 |
    |         3 |          1 |           1 | 1111     |
    |         4 |          1 |           1 | test2    |
    |         5 |          1 |           1 | test3    |
    +-----------+------------+-------------+----------+
    
    all users has same sys_userid and sys_groupid values, so API returns me data for first user (test1), but I asked data for second user (pclient1)

    Alse I tried to set client_id instead of sys_userid, but thats not correct. Table with sites (web_domain) has strange values:
    Code:
    mysql> select client_id, sys_userid, sys_groupid, username from client;
    +-----------+------------+-------------+----------+
    | client_id | sys_userid | sys_groupid | username |
    +-----------+------------+-------------+----------+
    |         1 |          1 |           1 | test1    |
    |         2 |          1 |           1 | pclient1 |
    |         3 |          1 |           1 | 1111     |
    |         4 |          1 |           1 | test2    |
    |         5 |          1 |           1 | test3    |
    +-----------+------------+-------------+----------+
    
    Can anybody help? How can I receive correct sys_userid?
     
  2. till

    till Super Moderator

    The sys_userid is the user that created the record, it is not necessarrily the owner of the record. If you wnat to get the owner, then use the sys_groupid.

    Your querys can not work as you used the sys_groupid and sys_userid of the client record. The client record is always owned by the administartor of the server.

    Example:

    Code:
    $groupid = client_get_groupid($session_id, $client_id);
    $sites = sites_web_domain_get($session_id, array("sys_groupid" => $groupid) );
     

Share This Page