Code

update: 'send_user_msg' accepts 'user' and 'group' tags now
authorrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 3 Sep 2008 09:28:20 +0000 (09:28 +0000)
committerrettenbe <rettenbe@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 3 Sep 2008 09:28:20 +0000 (09:28 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12354 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-si/server/events/gosaTriggered.pm
gosa-si/tests/client.php

index e18e0b4a7d8e105e5724511d928bf7c41d238ce6..0fe1127b261fcb425645ed3736ccd2befff84ac5 100644 (file)
@@ -86,8 +86,8 @@ sub send_user_msg {
     #my $subject = &decode_base64(@{$msg_hash->{'subject'}}[0]);   # just for debugging
     my $subject = @{$msg_hash->{'subject'}}[0];
     my $from = @{$msg_hash->{'from'}}[0];
-    my @users = exists $msg_hash->{'users'} ? @{$msg_hash->{'users'}} : () ;
-       my @groups = exists $msg_hash->{'groups'} ? @{$msg_hash->{'groups'}} : ();
+    my @users = exists $msg_hash->{'user'} ? @{$msg_hash->{'user'}} : () ;
+       my @groups = exists $msg_hash->{'group'} ? @{$msg_hash->{'group'}} : ();
     my $delivery_time = @{$msg_hash->{'delivery_time'}}[0];
     #my $message = &decode_base64(@{$msg_hash->{'message'}}[0]);   # just for debugging
     my $message = @{$msg_hash->{'message'}}[0];
@@ -121,6 +121,12 @@ sub send_user_msg {
        @users = map(push(@receiver_l, "u_$_"), @users);
        @groups = map(push(@receiver_l, "g_$_"), @groups);
 
+    # Sanitiy check of receivers list
+    if (@receiver_l == 0) {
+        &main::daemon_log("$session_id ERROR: 'send_usr_msg'-message contains neither a 'usr' nor a 'group' tag. No receiver specified.", 1); 
+        return;
+    }
+
     # add incoming message to messaging_db
     my $func_dic = {table=>$main::messaging_tn,
         primkey=>[],
index b8659926da12bc071c081012550214e1cb0030cd..52d106692521e140230b4a6a106c31686da22d84 100755 (executable)
@@ -74,7 +74,7 @@ for($count = 1; $count <= $zahl; $count++)
     #$data = "<xml> <header>gosa_get_login_usr_for_client</header> <target>GOSA</target> <source>GOSA</source> <client>00:01:6c:9d:b9:fa</client></xml>";
 
     # get_client_for_login_usr
-    $data = "<xml> <header>gosa_get_client_for_login_usr</header> <target>GOSA</target> <source>GOSA</source> <usr>rettenbe</usr></xml>";
+    #$data = "<xml> <header>gosa_get_client_for_login_usr</header> <target>GOSA</target> <source>GOSA</source> <usr>rettenbe</usr></xml>";
 
     # List all si-server providing opsi
     #$data = "<xml> <header>gosa_get_hosts_with_module</header> <source>GOSA</source> <target>10.89.1.31:20081</target> <module_name>opsi_com</module_name> </xml>";
@@ -87,8 +87,8 @@ for($count = 1; $count <= $zahl; $count++)
 
     ###########
     # messaging 
-    #$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from>  <to>polle</to> <to>rettenbe</to> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>"; 
-    #$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from>  <to>polle</to> <to>rettenbe</to> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>"; 
+    #$data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from>  <user>polle</user> <user>harald</user> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>"; 
+    $data = "<xml> <header>gosa_send_user_msg</header> <target>GOSA</target> <source>GOSA</source> <subject>".base64_encode("eine wichtige nachricht")."</subject> <from>admin</from> <delivery_time>20130101235959</delivery_time> <message>".base64_encode("kaffeepause")."</message> </xml>"; 
 
     ################
     # logHandling.pm