Hi, Updated to the latest SVN to solve the problem of not knowing what the newly created domain id was for the system_user, doc_root etc. params. Everything seems to work fine - except now the system_group value is wrong. This is the only value of the "advanced" values which is known to you before you call sites_web_domain_add - so I set it explicitly like so: PHP: $system_group = 'client'.$client_id; $params = array( 'server_id' => 1, 'ip_address' => '*', 'domain' => $input_domain, 'type' => 'vhost', 'parent_domain_id' =>'', 'vhost_type' =>'name', 'hd_quota' =>'-1', 'traffic_quota' => '-1', 'cgi' =>'n', 'ssi' =>'n', 'suexec' =>'n', 'errordocs' =>'1', 'subdomain' =>'www', 'ssl' =>'n', 'php' =>'mod', 'active' => 'y', 'redirect_type' =>'', 'redirect_path' =>'', 'ssl_state' =>'', 'ssl_locality' =>'', 'ssl_organisation' =>'', 'ssl_organisation_unit' =>'', 'ssl_country' =>'', 'ssl_domain' =>'', 'ssl_request' =>'', 'ssl_cert' =>'', 'ssl_bundle' =>'', 'ssl_action' =>'', 'stats_password' =>'',//! //everything below ignored as we are not SOAP admin user 'document_root' => 'a', // - "a" is just aplaceholder to avoid empty var errors! 'system_user' =>'a',//Should be updated by ISPCP later! 'system_group' =>$system_group, 'allow_override' =>'All', 'php_open_basedir' => 'a',//! 'apache_directives' =>'' ); But ISPConfig always sets system_group to client0 - Here's my server.sh output after an insert: Code: 09.09.2010-11:58 - DEBUG - Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock 09.09.2010-11:58 - DEBUG - Found 4 changes, starting update process. 09.09.2010-11:58 - DEBUG - Processed datalog_id 1123 09.09.2010-11:58 - DEBUG - Processed datalog_id 1124 09.09.2010-11:58 - DEBUG - Call function 'ssl' in plugin 'apache2_plugin' raised by event 'web_domain_insert'. 09.09.2010-11:58 - DEBUG - Call function 'insert' in plugin 'apache2_plugin' raised by event 'web_domain_insert'. 09.09.2010-11:58 - DEBUG - Creating Symlink: ln -s /var/log/ispconfig/httpd/testerdomain.dk /var/www/clients/client0/web204/log 09.09.2010-11:58 - DEBUG - Creating Symlink: ln -s /var/www/clients/client0/web204/ /var/www/testerdomain.dk ln: creating symbolic link `/var/www/clients/client104/testerdomain.dk': No such file or directory 09.09.2010-11:58 - DEBUG - Creating Symlink: ln -s /var/www/clients/client0/web204/ /var/www/clients/client104/testerdomain.dk 09.09.2010-11:58 - DEBUG - Adding the user: web204 09.09.2010-11:58 - DEBUG - exec: chown -R web204:client0 /var/www/clients/client0/web204 09.09.2010-11:58 - DEBUG - exec: chown web204:client0 /var/www/clients/client0/web204 09.09.2010-11:58 - DEBUG - exec: chmod 751 /var/www/clients/client0/web204/ 09.09.2010-11:58 - DEBUG - exec: chmod 751 /var/www/clients/client0/web204/* 09.09.2010-11:58 - DEBUG - exec: chmod 710 /var/www/clients/client0/web204/web 09.09.2010-11:58 - DEBUG - exec: chmod 777 /var/www/clients/client0/web204/tmp 09.09.2010-11:58 - DEBUG - exec: usermod --groups sshusers web204 09.09.2010-11:58 - DEBUG - exec: chown web204:client0 /var/www/clients/client0/web204 09.09.2010-11:58 - DEBUG - exec: chown web204:client0 /var/www/clients/client0/web204/log/error.log 09.09.2010-11:58 - DEBUG - Disable SSL for: 09.09.2010-11:58 - DEBUG - Add server alias: testerdomain.psst-psst.dk 09.09.2010-11:58 - DEBUG - Writing the vhost file: /etc/apache2/sites-available/testerdomain.dk.vhost 09.09.2010-11:58 - DEBUG - Creating the symlink: /etc/apache2/sites-enabled/testerdomain.dk.vhost => /etc/apache2/sites-available/testerdomain.dk.vhost 09.09.2010-11:58 - DEBUG - Apache status is: 1 09.09.2010-11:58 - DEBUG - Call function 'restartHttpd' in module 'web_module'. 09.09.2010-11:58 - DEBUG - Apache online status after restart is: 1 09.09.2010-11:58 - DEBUG - Processed datalog_id 1125 09.09.2010-11:58 - DEBUG - Call function 'ssl' in plugin 'apache2_plugin' raised by event 'web_domain_insert'. 09.09.2010-11:58 - DEBUG - Call function 'insert' in plugin 'apache2_plugin' raised by event 'web_domain_insert'. ln: creating symbolic link `/var/www/clients/client104/testerdomain.dk': No such file or directory 09.09.2010-11:58 - DEBUG - Creating Symlink: ln -s /var/www/clients/client0/web204/ /var/www/clients/client104/testerdomain.dk 09.09.2010-11:58 - DEBUG - exec: chmod 751 /var/www/clients/client0/web204/ 09.09.2010-11:58 - DEBUG - exec: chmod 751 /var/www/clients/client0/web204/* 09.09.2010-11:58 - DEBUG - exec: chmod 710 /var/www/clients/client0/web204/web 09.09.2010-11:58 - DEBUG - exec: chmod 777 /var/www/clients/client0/web204/tmp 09.09.2010-11:58 - DEBUG - exec: usermod --groups sshusers web204 09.09.2010-11:58 - DEBUG - exec: chown web204:client0 /var/www/clients/client0/web204 09.09.2010-11:58 - DEBUG - exec: chown web204:client0 /var/www/clients/client0/web204/log/error.log 09.09.2010-11:58 - DEBUG - Disable SSL for: 09.09.2010-11:58 - DEBUG - Add server alias: testerdomain.psst-psst.dk 09.09.2010-11:58 - DEBUG - Writing the vhost file: /etc/apache2/sites-available/testerdomain.dk.vhost 09.09.2010-11:58 - DEBUG - Apache status is: 1 09.09.2010-11:58 - DEBUG - Call function 'restartHttpd' in module 'web_module'. 09.09.2010-11:58 - DEBUG - Apache online status after restart is: 1 09.09.2010-11:58 - DEBUG - Processed datalog_id 1126 09.09.2010-11:58 - DEBUG - Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock finished. If you focus on the lines: ln: creating symbolic link `/var/www/clients/client104/testerdomain.dk': No such file or directory 09.09.2010-11:58 - DEBUG - Creating Symlink: ln -s /var/www/clients/client0/web204/ /var/www/clients/client104/testerdomain.dk Here it is clear something is going wrong. Any pointers would be welcome.
The problem obviously lies here in the new plugin sites_web_domain_plugin.inc.php: PHP: // get the ID of the client if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { $client_group_id = $_SESSION["s"]["user"]["default_group"]; $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id"); $client_id = intval($client["client_id"]); } else { //$client_id = intval($this->dataRecord["client_group_id"]); $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($page_form->dataRecord["client_group_id"])); $client_id = intval($client["client_id"]); } Where $client_id ends up being "0" - I am not quite sure how to fix this problem as, despite having looked at nothing but ISPConf code for a few weeks, I am not that hot on the nitty gritty details - any tips would be nice Does Julio lurk on this forum or should I try and throw him an email?
Please try to set "client_group_id" in the params array. A remoting user is basically logged in as "admin" when he performs any actions and as the website forms in the admin user view have a client selector (which is basically the list of groups from sys_group), you will have to provide the groupid in the params array.
Fair enough... But ... Hi Till I didn't get back to work on the system before today, hence the lateness in my reply. Your suggestion sounded perfectly sound and logical - but after having tried it out, I am still seeing the same issue. Do I maybe need to define client_group_id in web_domain.tform.php before it gets passed through? I added client_group_id to my params array like so: PHP: $params = array( 'server_id' => 1, 'ip_address' => '*', 'domain' => $input_domain, 'type' => 'vhost', 'parent_domain_id' =>'', 'vhost_type' =>'name', 'hd_quota' =>'-1', 'traffic_quota' => '-1', 'cgi' =>'n', 'ssi' =>'n', 'suexec' =>'n', 'errordocs' =>'1', 'subdomain' =>'www', 'ssl' =>'n', 'php' =>'mod', 'active' => 'y', 'redirect_type' =>'', 'redirect_path' =>'', 'ssl_state' =>'', 'ssl_locality' =>'', 'ssl_organisation' =>'', 'ssl_organisation_unit' =>'', 'ssl_country' =>'', 'ssl_domain' =>'', 'ssl_request' =>'', 'ssl_cert' =>'', 'ssl_bundle' =>'', 'ssl_action' =>'', 'stats_password' =>'',//! 'document_root' => 'a', // - "a" is just aplaceholder to avoid empty var errors! 'system_user' =>'a',//Should be updated by ISPCP later! 'system_group' =>$system_group, 'allow_override' =>'All', 'php_open_basedir' => 'a',//! 'apache_directives' =>'', 'client_group_id' =>$client_id );
No, it is handled by the event functions directly and not the default form handler. I think we will have to debug this. You might want to make a bugreport in the bugtracker and it will get checkd until the 3.0.3 final release.
this is what happens Ok - so setting client_group_id is actually working - it just seems that the ID's are a bit wonky with me here .... And I can't quite figure it out. If we step through the plugin code then this is what happens: First this runs, as we are admin: PHP: if($_SESSION["s"]["user"]["typ"] == 'admin' && isset($page_form->dataRecord["client_group_id"])) { $client_group_id = intval($page_form->dataRecord["client_group_id"]); $app->db->query("UPDATE web_domain SET sys_groupid = $client_group_id, sys_perm_group = 'ru' WHERE domain_id = ".$page_form->id); } This updates the web_domain table just fine, with the client_group_id that I pass to sites_web_domain_add - In my case that was the client_id I get back from client_add which was "112" Then further down, we have this piece of code: PHP: } else { $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($page_form->dataRecord["client_group_id"])); $client_id = intval($client["client_id"]); } As you can see, it is doing a lookup in sys_group to determine the client id (again) which I just passed through to the function. As the table looks like so: groupid name description client_id ... ... 72 testerdomain.dk 112 It is clear that what you want me to pass is the system group id to client_group_id and not the actual client_id. Now we are back to the chicken and the egg problem which the plugin was supposed to fix, as I do not know the group id at this point. So what I need to do first is call a method which returns the system user / group id? All I see in remoting.inc.php is public function client_get_id($session_id, $sys_userid) Which seems to take the sys id I want returned and return the client id (which I already know) My hack would be to do an independent mysql query and fetch the group id - but I'd like to avoid that if possible. ?
Any news on this? Is this a bug that I should add to the bugtracker or is there a more "correct" way of getting the group id?
lo, I also discovered this issue, which is holding me back slightly in our implementation. zabersoft, have you logged this as a bug yet? Ta for all the investigation work upto this point too!
But as you see it is in the else part of the query, so it does not get executed when you are llogged in as admin user and the remoting framework has admin user status. The remoting framework works with the client_id and not the sys_userid. The sys_userid and sys_groupid is only for internal use in ispconfig and may change or may be different even for the same client. So dont rely on that, use the client_id instead. The sys_userid of the records is always set by the remoting framework automatically, so do not pass it in the params array as it get oiverwritten anyway.
Hi Till, No, you are almost correct but not quite - the else statement you see above is not in connection with the first part of code - it is further down in the plugin code - the entire statement is like so: PHP: // get the ID of the client if($_SESSION["s"]["user"]["typ"] != 'admin' && !$app->auth->has_clients($_SESSION['s']['user']['userid'])) { $client_group_id = $_SESSION["s"]["user"]["default_group"]; $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = $client_group_id"); $client_id = intval($client["client_id"]); } else { //$client_id = intval($this->dataRecord["client_group_id"]); $client = $app->db->queryOneRecord("SELECT client_id FROM sys_group WHERE sys_group.groupid = ".intval($page_form->dataRecord["client_group_id"])); $client_id = intval($client["client_id"]); } I see this as IF NOT admin DO stuff else DO wrong stuff I am complaining about I have tested this - if fetch the groupid manually from the db and then pass the groupid as client_id - everything works as it should And as you say yourself - this should not be happening. So I maintain that the code is buggy.