fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [11141] bkbooking: stavanger update


From: Kjell Arne Espedal
Subject: [Fmsystem-commits] [11141] bkbooking: stavanger update
Date: Fri, 31 May 2013 06:57:33 +0000

Revision: 11141
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11141
Author:   kjell
Date:     2013-05-31 06:57:30 +0000 (Fri, 31 May 2013)
Log Message:
-----------
bkbooking: stavanger update

Modified Paths:
--------------
    branches/stavangerkommune/bookingfrontend/inc/class.bouser.inc.php
    branches/stavangerkommune/phpgwapi/templates/stavanger/head.inc.php

Modified: branches/stavangerkommune/bookingfrontend/inc/class.bouser.inc.php
===================================================================
--- branches/stavangerkommune/bookingfrontend/inc/class.bouser.inc.php  
2013-05-31 06:43:36 UTC (rev 11140)
+++ branches/stavangerkommune/bookingfrontend/inc/class.bouser.inc.php  
2013-05-31 06:57:30 UTC (rev 11141)
@@ -3,8 +3,8 @@
        {
                const ORGNR_SESSION_KEY = 'orgnr';
                
-               public $orgnr = null;
-               public $orgname = null;
+               public
+                       $orgnr = null;
 
                protected
                        $default_module = 'bookingfrontend',
@@ -20,20 +20,8 @@
                public function __construct() {
                        $this->set_module();
                        $this->orgnr = $this->get_user_orgnr_from_session();
-                       $this->orgname = 
$this->get_orgname_from_db($this->get_user_orgnr_from_session());
                }
                
-               protected function get_orgname_from_db($orgnr) 
-               {
-                       $this->db = & $GLOBALS['phpgw']->db;
-                       $this->db->limit_query("select name from 
bb_organization where organization_number ='" .$orgnr."'", 0, __LINE__, 
__FILE__, 1);
-                       if(!$this->db->next_record())
-                       {
-                               return $orgnr;
-                       }
-                       return $this->db->f('name', false);
-
-               }
                protected function set_module($module = null)
                {
                        $this->module = is_string($module) ? $module : 
$this->default_module;
@@ -43,12 +31,11 @@
                {
                        return $this->module;
                }
-
+               
                public function log_in()
                {
                        $this->log_off();
                        $this->orgnr = $this->get_user_orgnr_from_auth_header();
-                       $this->orgname = 
$this->get_orgname_from_db($this->get_user_orgnr_from_auth_header());
 
 /*
                        try 
@@ -86,7 +73,6 @@
                protected function clear_user_orgnr()
                {
                        $this->orgnr = null;
-                       $this->orgname = null;
                }
                
                public function get_user_orgnr()
@@ -164,82 +150,64 @@
                                return null;
                        }
                }
-
                
                protected function get_user_orgnr_from_auth_header()
                {
                        $config         = 
CreateObject('phpgwapi.config','bookingfrontend');
                        $config->read();
 
-#                      echo "<pre>\n";
+                       $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.*$/';
 
-#                      $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');
+                       $headers = getallheaders();
 
-#                      print_r($xmldata);
-#                      echo "\n";
-                       $myorgnr = null;
-                       foreach ($xmldata->melding->roller->enhet->orgnr as 
$key => $value) {
-                               $myorgnr = $value;
+                       if(isset($config->config_data['debug']) && 
$config->config_data['debug'])
+                       {
+                               $this->debug = true;
+                               echo 'headers:<br>';
+                               _debug_array($headers);
                        }
 
-                       $external_user = (object) 'ciao'; $external_user->login 
= $myorgnr;
+                       if(isset($headers[$header_key]) && 
$headers[$header_key])
+                       {
+                               $matches = array();
+                               
preg_match_all($header_regular_expression,$headers[$header_key], $matches);
+                               $userid = $matches[1][0];
 
-#                      exit;
+                               if($this->debug)
+                               {
+                                       echo 'matches:<br>';
+                                       _debug_array($matches);
+                               }
 
-#                      $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.*$/';
+                       }
 
-#                      $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;
-
-#                      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);
+                       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;
 

Modified: branches/stavangerkommune/phpgwapi/templates/stavanger/head.inc.php
===================================================================
--- branches/stavangerkommune/phpgwapi/templates/stavanger/head.inc.php 
2013-05-31 06:43:36 UTC (rev 11140)
+++ branches/stavangerkommune/phpgwapi/templates/stavanger/head.inc.php 
2013-05-31 06:57:30 UTC (rev 11141)
@@ -143,7 +143,7 @@
        $bouser = CreateObject('bookingfrontend.bouser');
        if($bouser->is_logged_in())
        {
-               $tpl_vars['login_text'] = $bouser->orgname . ' :: ' . 
lang('Logout');
+               $tpl_vars['login_text'] = $bouser->orgnr . ' :: ' . 
lang('Logout');
                $tpl_vars['login_url'] = 'logout.php';
        }
        else




reply via email to

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