fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [11367] bkbooking: stavanger minid update + bugfix ca


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [11367] bkbooking: stavanger minid update + bugfix calender and event email
Date: Fri, 11 Oct 2013 13:08:04 +0000

Revision: 11367
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11367
Author:   kjell
Date:     2013-10-11 13:08:03 +0000 (Fri, 11 Oct 2013)
Log Message:
-----------
bkbooking: stavanger minid update + bugfix calender and event email

Modified Paths:
--------------
    branches/stavangerkommune/booking/inc/class.sobuilding.inc.php
    branches/stavangerkommune/booking/inc/class.uievent.inc.php
    branches/stavangerkommune/bookingfrontend/inc/class.bouser.inc.php

Added Paths:
-----------
    branches/stavangerkommune/bookingfrontend/inc/custom/default/MinId.php

Modified: branches/stavangerkommune/booking/inc/class.sobuilding.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.sobuilding.inc.php      
2013-10-11 11:02:27 UTC (rev 11366)
+++ branches/stavangerkommune/booking/inc/class.sobuilding.inc.php      
2013-10-11 13:08:03 UTC (rev 11367)
@@ -36,7 +36,7 @@
 
                function get_endofseason($id)
                {
-                       $this->db->limit_query("SELECT to_ FROM bb_season WHERE 
status = 'PUBLISHED' AND active=1 AND building_id =" . intval($id), 0, 
__LINE__, __FILE__, 1);
+                       $this->db->limit_query("SELECT to_ FROM bb_season WHERE 
status = 'PUBLISHED' AND active=1 AND building_id =" . intval($id) . "ORDER BY 
to_ DESC", 0, __LINE__, __FILE__, 1);
                        if(!$this->db->next_record())
                        {
                 return false;        

Modified: branches/stavangerkommune/booking/inc/class.uievent.inc.php
===================================================================
--- branches/stavangerkommune/booking/inc/class.uievent.inc.php 2013-10-11 
11:02:27 UTC (rev 11366)
+++ branches/stavangerkommune/booking/inc/class.uievent.inc.php 2013-10-11 
13:08:03 UTC (rev 11367)
@@ -643,6 +643,11 @@
 
                                                                $sendt = 0;
                                                                $mail_sendt_to 
= '';
+                                                               
if($event['contact_email']) {
+                                                                       
$sendt++;
+                                                                       
$mail_sendt_to = $mail_sendt_to.' '.$event['contact_email'];
+                                    
$this->send_mailnotification($event['contact_email'], $subject, $body);
+                                                               } 
                                                                
if($building_info['email']) {
                                                                        
$sendt++;
                                                                        
$mail_sendt_to = $mail_sendt_to.' '.$building_info['email'];

Modified: branches/stavangerkommune/bookingfrontend/inc/class.bouser.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/class.bouser.inc.php  
2013-10-11 11:02:27 UTC (rev 11366)
+++ branches/stavangerkommune/bookingfrontend/inc/class.bouser.inc.php  
2013-10-11 13:08:03 UTC (rev 11367)
@@ -170,86 +170,80 @@
                {
                        $config         = 
CreateObject('phpgwapi.config','bookingfrontend');
                        $config->read();
+        
+            if ($config->config_data['authentication_method'] === 'MinId.php') 
{
 
-            header('Content-type: text/xml');
-            $ipdp = $_COOKIE['iPlanetDirectoryPro'];
-#            $xmldata = 
simplexml_load_file('http://svgk-webagent.lab.redpill-linpro.com:8080/spclient/auth.jsp?ipdp='.$ipdp);
-            $xmldata = 
simplexml_load_file('http://aktivby.stavanger.kommune.no:8080/spclient/auth.jsp?ipdp='.$ipdp);
+                header('Content-type: text/xml');
+#               $ipdp = $_COOKIE['iPlanetDirectoryPro'];
+#               $xmldata = 
simplexml_load_file('http://aktivby.stavanger.kommune.no:8080/spclient/auth.jsp?ipdp='.$ipdp);
 
+                       $xmldata = 
simplexml_load_file('/srv/portico/svg/stavangerkommune_xml/test.xml');
 
-#                      echo "<pre>\n";
+                       $myorgnr = null;
+                       foreach ($xmldata->melding->roller->enhet->orgnr as 
$key => $value) {
+                               $myorgnr = $value;
+                       }
 
-#                      $xmldata = 
simplexml_load_file('/srv/portico/stavangerkommune_xml/KnutHelle.xml');
-#                      $xmldata = 
simplexml_load_file('/srv/portico/stavangerkommune_xml/AneYrjaHolter.xml');
-#                      $xmldata = 
simplexml_load_file('/srv/portico/stavangerkommune_xml/HanneDale.xml');
-#                      $xmldata = 
simplexml_load_file('/srv/portico/svg/stavangerkommune_xml/test.xml');
+                       $external_user = (object) 'ciao'; $external_user->login 
= $myorgnr;
 
-#                      print_r($xmldata);
-#                      echo "\n";
-                       $myorgnr = null;
-                       foreach ($xmldata->melding->roller->enhet->orgnr as 
$key => $value) {
-                               $myorgnr = $value;
-                       }
+            } else {
 
-                       $external_user = (object) 'ciao'; $external_user->login 
= $myorgnr;
+                       $header_key = isset($config->config_data['header_key']) 
&& $config->config_data['header_key'] ? $config->config_data['header_key'] : 
'Osso-User-Dn';
+                       $header_regular_expression = 
isset($config->config_data['header_regular_expression']) && 
$config->config_data['header_regular_expression'] ? 
$config->config_data['header_regular_expression'] : '/^cn=(.*),cn=users.*$/';
 
-#                      exit;
+                       $headers = getallheaders();
 
-#                      $header_key = isset($config->config_data['header_key']) 
&& $config->config_data['header_key'] ? $config->config_data['header_key'] : 
'Osso-User-Dn';
-#                      $header_regular_expression = 
isset($config->config_data['header_regular_expression']) && 
$config->config_data['header_regular_expression'] ? 
$config->config_data['header_regular_expression'] : '/^cn=(.*),cn=users.*$/';
+                       if(isset($config->config_data['debug']) && 
$config->config_data['debug'])
+                       {
+                               $this->debug = true;
+                               echo 'headers:<br>';
+                               _debug_array($headers);
+                       }
+    
+                       if(isset($headers[$header_key]) && 
$headers[$header_key])
+                       {
+                               $matches = array();
+                               
preg_match_all($header_regular_expression,$headers[$header_key], $matches);
+                               $userid = $matches[1][0];
+    
+                               if($this->debug)
+                               {
+                                       echo 'matches:<br>';
+                                       _debug_array($matches);
+                               }
+    
+                       }
 
-#                      $headers = getallheaders();
+                       $options = array();
+                       $options['soap_version'] = SOAP_1_1;
+                       $options['location']    = 
isset($config->config_data['soap_location']) && 
$config->config_data['soap_location'] ? $config->config_data['soap_location'] : 
'';// 'http://soat1a.srv.bergenkom.no:8888/gateway/services/BrukerService-v1';
+                       $options['uri']                 = 
isset($config->config_data['soap_uri']) && $config->config_data['soap_uri'] ? 
$config->config_data['soap_uri'] : '';// 'http://soat1a.srv.bergenkom.no';
+                       $options['trace']               = 1;
 
-#                      if(isset($config->config_data['debug']) && 
$config->config_data['debug'])
-#                      {
-#                              $this->debug = true;
-#                              echo 'headers:<br>';
-#                              _debug_array($headers);
-#                      }
+                       if(isset($config->config_data['soap_proxy_host']) && 
$config->config_data['soap_proxy_host'])
+                       {
+                               $options['proxy_host']  = 
$config->config_data['soap_proxy_host'];
+                       }
 
-#                      if(isset($headers[$header_key]) && 
$headers[$header_key])
-#                      {
-#                              $matches = array();
-#                              
preg_match_all($header_regular_expression,$headers[$header_key], $matches);
-#                              $userid = $matches[1][0];
+                       if(isset($config->config_data['soap_proxy_port']) && 
$config->config_data['soap_proxy_port'])
+                       {
+                               $options['proxy_port']  = 
$config->config_data['soap_proxy_port'];
+                       }
+                       $options['encoding']    = 
isset($config->config_data['soap_encoding']) && 
$config->config_data['soap_encoding'] ? $config->config_data['soap_encoding'] : 
'UTF-8';
+                       $options['login']               = 
isset($config->config_data['soap_login']) && $config->config_data['soap_login'] 
? $config->config_data['soap_login'] : '';
+                       $options['password']    = 
isset($config->config_data['soap_password']) && 
$config->config_data['soap_password'] ? $config->config_data['soap_password'] : 
'';
 
-#                              if($this->debug)
-#                              {
-#                                      echo 'matches:<br>';
-#                                      _debug_array($matches);
-#                              }
+                       $wsdl = isset($config->config_data['soap_wsdl']) && 
$config->config_data['soap_wsdl'] ? $config->config_data['soap_wsdl'] : '';// 
'http://soat1a.srv.bergenkom.no:8888/gateway/services/BrukerService-v1?wsdl';
 
-#                      }
+                       $authentication_method  = 
isset($config->config_data['authentication_method']) && 
$config->config_data['authentication_method'] ? 
$config->config_data['authentication_method'] : '';
 
-#                      $options = array();
-#                      $options['soap_version'] = SOAP_1_1;
-#                      $options['location']    = 
isset($config->config_data['soap_location']) && 
$config->config_data['soap_location'] ? $config->config_data['soap_location'] : 
'';// 'http://soat1a.srv.bergenkom.no:8888/gateway/services/BrukerService-v1';
-#                      $options['uri']                 = 
isset($config->config_data['soap_uri']) && $config->config_data['soap_uri'] ? 
$config->config_data['soap_uri'] : '';// 'http://soat1a.srv.bergenkom.no';
-#                      $options['trace']               = 1;
+                       require_once 
PHPGW_SERVER_ROOT."/bookingfrontend/inc/custom/default/{$authentication_method}";
+                       
+                       $external_user = new booking_external_user($wsdl, 
$options, $userid, $this->debug);
+                       // test values
+                       //$external_user = (object) 'ciao'; 
$external_user->login = 994239929;
+            }
 
-#                      if(isset($config->config_data['soap_proxy_host']) && 
$config->config_data['soap_proxy_host'])
-#                      {
-#                              $options['proxy_host']  = 
$config->config_data['soap_proxy_host'];
-#                      }
-
-#                      if(isset($config->config_data['soap_proxy_port']) && 
$config->config_data['soap_proxy_port'])
-#                      {
-#                              $options['proxy_port']  = 
$config->config_data['soap_proxy_port'];
-#                      }
-#                      $options['encoding']    = 
isset($config->config_data['soap_encoding']) && 
$config->config_data['soap_encoding'] ? $config->config_data['soap_encoding'] : 
'UTF-8';
-#                      $options['login']               = 
isset($config->config_data['soap_login']) && $config->config_data['soap_login'] 
? $config->config_data['soap_login'] : '';
-#                      $options['password']    = 
isset($config->config_data['soap_password']) && 
$config->config_data['soap_password'] ? $config->config_data['soap_password'] : 
'';
-
-#                      $wsdl = isset($config->config_data['soap_wsdl']) && 
$config->config_data['soap_wsdl'] ? $config->config_data['soap_wsdl'] : '';// 
'http://soat1a.srv.bergenkom.no:8888/gateway/services/BrukerService-v1?wsdl';
-
-#                      $authentication_method  = 
isset($config->config_data['authentication_method']) && 
$config->config_data['authentication_method'] ? 
$config->config_data['authentication_method'] : '';
-
-#                      require_once 
PHPGW_SERVER_ROOT."/bookingfrontend/inc/custom/default/{$authentication_method}";
-#                      
-#                      $external_user = new booking_external_user($wsdl, 
$options, $userid, $this->debug);
-                       // test values
-                       //$external_user = (object) 'ciao'; 
$external_user->login = 994239929;
-
                        if($this->debug)
                        {
                                echo 'External user:<br>';

Added: branches/stavangerkommune/bookingfrontend/inc/custom/default/MinId.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/custom/default/MinId.php      
                        (rev 0)
+++ branches/stavangerkommune/bookingfrontend/inc/custom/default/MinId.php      
2013-10-11 13:08:03 UTC (rev 11367)
@@ -0,0 +1,288 @@
+<?php
+       /**
+       * phpGroupWare
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2010 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package phpgroupware
+       * @subpackage communication
+       * @category core
+       * @version $Id: Altinn_Bergen_kommune.php 4887 2010-02-23 10:33:44Z 
sigurd $
+       */
+
+       /*
+          This program is free software: you can redistribute it and/or modify
+          it under the terms of the GNU General Public License as published by
+          the Free Software Foundation, either version 2 of the License, or
+          (at your option) any later version.
+
+          This program is distributed in the hope that it will be useful,
+          but WITHOUT ANY WARRANTY; without even the implied warranty of
+          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+          GNU General Public License for more details.
+
+          You should have received a copy of the GNU General Public License
+          along with this program.  If not, see <http://www.gnu.org/licenses/>.
+        */
+
+       /**
+        * Wrapper for custom methods
+        *
+        * @package phpgroupware
+        * @subpackage bookingfrontend
+        */
+
+       /**
+       * START WRAPPER
+       */
+
+       class booking_external_user
+       {
+               /**
+                * The resulting external user
+                * @access public
+                * @var string
+                */
+               public $login = 0;
+
+               /**
+                * Debug for testing
+                * @access public
+                * @var bool
+                */
+               public $debug = false;
+
+               public function __construct($wsdl, $options, $userid, $debug = 
false)
+               {
+                       if($debug)
+                       {
+                               $this->debug = true;
+                       }
+                       try
+                       {
+                               $BrukerService  = new BrukerService($wsdl, 
$options);
+                       }
+                       catch(Exception $e)
+                       {
+                               if($this->debug)
+                               {
+                                       echo $e->getMessage();
+                                       echo '<br>wsdl: ' . $wsdl;
+                                       echo '<br>options:';
+                                       _debug_array($options);
+                               }
+                       }
+
+                       if(isset($BrukerService) && $BrukerService)
+                       {
+                               $ctx                    = new UserContext();
+
+                               $ctx->appid = 'portico';
+                               $ctx->onBehalfOfId= $userid;
+                               $ctx->userid = $userid;
+                               $ctx->transactionid = 
$GLOBALS['phpgw_info']['server']['install_id']; // KAN UTELATES. BENYTTES I.F.M 
SUPPORT. LEGG INN EN FOR DEG UNIK ID.
+
+                               $request = new retrieveBruker();
+                               $request->userContext = $ctx;
+                               $request->userid = $userid;
+
+                               $response = 
$BrukerService->retrieveBruker($request);
+                               $Bruker = $response->return;
+                               $this->login = $Bruker->ou; // organisasjons nr
+                       }
+               }
+       }
+
+       /**
+       * END WRAPPER - custom code beyond this point
+       */
+
+       /**
+        * soap client for altinn supported external login service at Bergen 
Kommune
+        * this code is generated by the 
http://code.google.com/p/wsdl2php-interpreter/ 
+        *
+        * @package phpgroupware
+        * @subpackage bookingfrontend
+        */
+
+
+       /**
+        * Bruker
+        */
+       class Bruker
+       {
+               /**
+                * @access public
+                * @var string
+                */
+               public $uid;
+               /**
+                * @access public
+                * @var string
+                */
+               public $mail;
+               /**
+                * @access public
+                * @var string
+                */
+               public $preferedLocal;
+               /**
+                * @access public
+                * @var string
+                */
+               public $givenName;
+               /**
+                * @access public
+                * @var string
+                */
+               public $sn;
+               /**
+                * @access public
+                * @var string
+                */
+               public $cn;
+               /**
+                * @access public
+                * @var string
+                */
+               public $ou;
+       }
+
+       /**
+        * UserContext
+        */
+       class UserContext
+       {
+               /**
+                * @access public
+                * @var string
+                */
+               public $userid;
+               /**
+                * @access public
+                * @var string
+                */
+               public $onBehalfOfId;
+               /**
+                * @access public
+                * @var string
+                */
+               public $appid;
+               /**
+                * @access public
+                * @var string
+                */
+               public $transactionid;
+       }
+       
+       /**
+        * retrieveBruker
+        */
+       class retrieveBruker
+       {
+               /**
+                * @access public
+                * @var UserContext
+                */
+               public $userContext;
+               /**
+                * @access public
+                * @var string
+                */
+               public $userid;
+       }
+
+       /**
+        * retrieveBrukerResponse
+        */
+       class retrieveBrukerResponse
+       {
+               /**
+                * @access public
+                * @var Bruker
+                */
+               public $return;
+       }
+
+       /**
+        * BrukerService
+        * @author WSDLInterpreter
+        */
+       class BrukerService extends SoapClient
+       {
+               /**
+                * Default class map for wsdl=>php
+                * @access private
+                * @var array
+                */
+               private static $classmap = array
+               (
+                       "Bruker" => "Bruker",
+                       "UserContext" => "UserContext",
+                       "retrieveBruker" => "retrieveBruker",
+                       "retrieveBrukerResponse" => "retrieveBrukerResponse",
+               );
+       
+               /**
+                * Constructor using wsdl location and options array
+                * @param string $wsdl WSDL location for this service
+                * @param array $options Options for the SoapClient
+                */
+               public function __construct($wsdl='', $options=array())
+               {
+                       foreach(self::$classmap as $wsdlClassName => 
$phpClassName)
+                       {
+                           if(!isset($options['classmap'][$wsdlClassName]))
+                           {
+                               $options['classmap'][$wsdlClassName] = 
$phpClassName;
+                           }
+                       }
+                       parent::__construct($wsdl, $options);
+               }
+
+               /**
+                * Checks if an argument list matches against a valid argument 
type list
+                * @param array $arguments The argument list to check
+                * @param array $validParameters A list of valid argument types
+                * @return boolean true if arguments match against 
validParameters
+                * @throws Exception invalid function signature message
+                */
+               public function _checkArguments($arguments, $validParameters)
+               {
+                       $variables = "";
+                       foreach ($arguments as $arg)
+                       {
+                           $type = gettype($arg);
+                           if ($type == "object")
+                           {
+                               $type = get_class($arg);
+                           }
+                           $variables .= "(".$type.")";
+                       }
+                       if (!in_array($variables, $validParameters))
+                       {
+                           throw new Exception("Invalid parameter types: 
".str_replace(")(", ", ", $variables));
+                       }
+                       return true;
+               }
+
+               /**
+                * Service Call: retrieveBruker
+                * Parameter options:
+                * (retrieveBruker) parameters
+                * @param mixed,... See function description for parameter 
options
+                * @return retrieveBrukerResponse
+                * @throws Exception invalid function signature message
+                */
+               public function retrieveBruker($mixed = null)
+               {
+                       $validParameters = array(
+                               "(retrieveBruker)",
+                       );
+                       $args = func_get_args();
+                       $this->_checkArguments($args, $validParameters);
+                       return $this->__soapCall("retrieveBruker", $args);
+               }
+       }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]