#1  
Old 15th August 2011, 14:06
osterhase osterhase is offline
Member
 
Join Date: Jul 2011
Location: Germany
Posts: 63
Thanks: 6
Thanked 7 Times in 5 Posts
Default Announce update for mailfilters

Hi there!

I'm still struggeling to implement the possibility for my roundcube users to edit their spamfilters via the webinterface using the according roundcube-plugin. My newest plan:

The filterrules are written into a file (roundcube.sieve) - the syntax of this file is fully understood by ispconfig due to the fact that it is a regular sieve syntax.

I managed to convince the roundcube-plugin to insert the content of the file into dbispconfig.mail_user.custom_mailfilter. But obviously it is not respected by the server.sh as an update and so it is not written into file and takes no effect.

Here is my question: How can I convince ispconfig 3.0.3.3 do run an update for mail_filter_edit?

In a bigger frame: Is that generally possible?

I would - as always - appreciate any suggestions.
Reply With Quote
Sponsored Links
  #2  
Old 15th August 2011, 14:11
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,796
Thanks: 840
Thanked 5,612 Times in 4,423 Posts
Default

Quote:
I managed to convince the roundcube-plugin to insert the content of the file into dbispconfig.mail_user.custom_mailfilter. But obviously it is not respected by the server.sh as an update and so it is not written into file and takes no effect.
If you want to update a field in the ispconfig database, use the datalogUpdate function of the ispconfig mysql library or the remoting API. If you do the updates without these functions, then all changes will be ignored.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 15th August 2011, 17:18
osterhase osterhase is offline
Member
 
Join Date: Jul 2011
Location: Germany
Posts: 63
Thanks: 6
Thanked 7 Times in 5 Posts
Default

Thanks for your fast reply. Just to unterstand the concept:

API: Is basically meant to create an interface between (in this case) roundcube and ISPConfig. A php-script is wirtten that logs into ISPConfig as a remote-user which is equipped with certain rights (f.e. mail-user-edit) and makes certain changes defined in the scirpt.

...so I think I'll try to go with the API-solution.

I had a look at the examples and I think that the soap-mail-user-update.php file is my one. Due to the fact, that I only want to update one field in the db-table I wanted to ask if this is possible via API.

Currently all fields in the array inserted:

Code:
$params = array(	'server_id' => 1,
				'email' => 'test23@domain.ltd',
				'password' => 'testen',
				'quota' => '10',
				'maildir' => '/var/vmail/domain.ltd/test23',
				'homedir' => '/var/vmail',
				'uid' => '5000',
				'gid' => '5000',
				'postfix' => 'y',
				'disableimap' => 'n',
				'disablepop3' => 'n');
If this is not possible and the entire record is written completly new using the mail_user_update function it would be the best way to query the current entries from the db, save them as variables and then send them back to the params array, like:

Code:
$params = array(	'server_id' => 1,
				'email' => $email,
				'password' => $pass,
(...)
Am I correct here or completly of the track?

References:
http://www.howtoforge.com/how-to-cre...or-ispconfig-3

And: /tmp/ispconfig3_install/remoting_client/examples/soap-mailuser-update.php

A punch into any direction is appreciated (whereas "give up" does not count).
Reply With Quote
  #4  
Old 15th August 2011, 17:56
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,796
Thanks: 840
Thanked 5,612 Times in 4,423 Posts
Default

You can not update a single field. A update call has to contain all fields. So the easiest way is to use the mail user get function to retrive the current mailuser, the function returns an array of all fields of that mailuser, then change the value that you intended to cahnge and pass the whole array back as $params to the mail user update function.
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #5  
Old 15th August 2011, 19:57
osterhase osterhase is offline
Member
 
Join Date: Jul 2011
Location: Germany
Posts: 63
Thanks: 6
Thanked 7 Times in 5 Posts
Default

Sorry to bother again... do you mean the function that is defined in remoting.inc.php? I got up that bit of the code that calls the function but don't know how to get the array returned or printed. I would appreciate your help.

Ah - by the way - am I right that the primary_id is the mail_user_id? (or how is the mailuser defined?)

Code:
<?php

$username = 'xxx';
$password = 'xxx';

$soap_location = 'http://localhost:8005/remote/index.php';
$soap_uri = 'http://localhost:8005/remote/';


$client = new SoapClient(null, array('location' => $soap_location,
                                     'uri'      => $soap_uri));

try {
	if($session_id = $client->login($username,$password)) {
		echo 'Login sucessful. Session-ID:'.$session_id.'<br />';
	}

	$primary_id = 108;
	$domain__id = $client->mail_user_get($session_id, $primary_id);

		if($client->logout($session_id)) {
		echo 'Logout succesful.<br />';
	}

	
} catch (SoapFault $e) {
	die('SOAP Blad: '.$e->getMessage());
}

?>
Reply With Quote
  #6  
Old 15th August 2011, 20:52
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lneburg, Germany
Posts: 36,796
Thanks: 840
Thanked 5,612 Times in 4,423 Posts
Default

Yes, thats the function. You just have to pass the mailuser_id to the function and it will return the mailuser record-
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
Reply

Bookmarks

Tags
roundcube

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
My Centos is terribly slow Galled Server Operation 9 7th December 2010 16:31
Vhosts...conf not synced to changes crypted General 50 24th April 2010 01:54
The system is currently updating the configuration files. warlock General 8 21st February 2009 19:15
High Availability Samba cluster - DRBD + Heartbeat djalex Server Operation 58 25th May 2007 20:38
HotSaNIC domino Tips/Tricks/Mods 23 6th November 2006 06:19


All times are GMT +2. The time now is 05:04.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.