fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6635] merge 6632:6634 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [6635] merge 6632:6634 from trunk
Date: Wed, 24 Nov 2010 22:03:46 +0000

Revision: 6635
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6635
Author:   sigurdne
Date:     2010-11-24 22:03:45 +0000 (Wed, 24 Nov 2010)
Log Message:
-----------
merge 6632:6634 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/frontend/inc/class.bofrontend.inc.php
    branches/Version-1_0-branch/frontend/inc/hook_config.inc.php
    branches/Version-1_0-branch/frontend/setup/setup.inc.php
    branches/Version-1_0-branch/frontend/templates/base/config.tpl
    branches/Version-1_0-branch/login.php
    branches/Version-1_0-branch/rental/inc/class.socontract.inc.php

Added Paths:
-----------
    branches/Version-1_0-branch/frontend/inc/class.hook_helper.inc.php

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6627,6629-6631
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516,6518,6520-6524,6526-6528,6533-6534,6536-6541,6543-6565,6567,6569,6571-6576,6578,6580-6586,6588-6596,6598-6600,6602-6604,6606-6607,6609-6611,6613-6625,6627,6629-6631,6633-6634

Modified: branches/Version-1_0-branch/frontend/inc/class.bofrontend.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.bofrontend.inc.php   
2010-11-24 21:41:50 UTC (rev 6634)
+++ branches/Version-1_0-branch/frontend/inc/class.bofrontend.inc.php   
2010-11-24 22:03:45 UTC (rev 6635)
@@ -126,14 +126,14 @@
                 * @param string $lastname the user's last name
                 * @param string $password      the user's password
                 */
-               public static function create_delegate_account(string 
$username, string $firstname, string $lastname, string $password)
+               public static function create_delegate_account(string 
$username, string $firstname, string $lastname, string $password, $group_lid = 
'frontend_delegates')
                {
                        
                        // Create group account if needed
-                       if 
(!$GLOBALS['phpgw']->accounts->exists('frontend_delegates') ) // No group 
account exist
+                       if (!$GLOBALS['phpgw']->accounts->exists($group_lid) ) 
// No group account exist
                        {
                                $account                        = new 
phpgwapi_group();
-                               $account->lid           = 'frontend_delegates';
+                               $account->lid           = $group_lid;
                                $account->firstname = 'Frontend';
                                $account->lastname      = 'Delegates';
                                $frontend_delegates     = 
$GLOBALS['phpgw']->accounts->create($account, array(), array(), $modules);
@@ -154,7 +154,7 @@
                        }
                        else
                        {
-                               $frontend_delegates             = 
$GLOBALS['phpgw']->accounts->name2id('frontend_delegates');
+                               $frontend_delegates             = 
$GLOBALS['phpgw']->accounts->name2id($group_lid);
                        }
                        
                        if(isset($username) && isset($firstname) && 
isset($lastname) && isset($password))

Copied: branches/Version-1_0-branch/frontend/inc/class.hook_helper.inc.php 
(from rev 6634, trunk/frontend/inc/class.hook_helper.inc.php)
===================================================================
--- branches/Version-1_0-branch/frontend/inc/class.hook_helper.inc.php          
                (rev 0)
+++ branches/Version-1_0-branch/frontend/inc/class.hook_helper.inc.php  
2010-11-24 22:03:45 UTC (rev 6635)
@@ -0,0 +1,70 @@
+<?php
+       /**
+        * rental - Hook helper
+        *
+        * @author Dave Hall <address@hidden>
+        * @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
+        * @package rental
+        * @version $Id: class.hook_helper.inc.php 5822 2010-05-27 12:21:50Z 
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/>.
+        */
+
+
+       phpgw::import_class('frontend.bofrontend');
+       phpgw::import_class('frontend.bofellesdata');
+
+       /**
+        * Hook helper
+        *
+        * @package rental
+        */
+       class frontend_hook_helper
+       {
+               /**
+                * Create useraccount on login for SSO/ntlm
+                *
+                * @return void
+                */
+               public function auto_addaccount()
+               {
+                       $account_lid = $GLOBALS['hook_values']['account_lid'];
+
+                       if(!$GLOBALS['phpgw']->accounts->exists($account_lid))
+                       {
+                               $config = CreateObject('phpgwapi.config', 
'frontend');
+                               $config->read();
+                               $autocreate_user = 
isset($config->config_data['autocreate_user']) && 
$config->config_data['autocreate_user'] ? 
$config->config_data['autocreate_user'] : 0;
+
+                               if($autocreate_user)
+                               {
+                                       $fellesdata_user = 
frontend_bofellesdata::get_instance()->get_user($account_lid);
+                                       if($fellesdata_user)
+                                       {
+                                               // Read default assign-to-group 
from config
+                                               $default_group_id = 
isset($config->config_data['frontend_default_group']) && 
$config->config_data['frontend_default_group'] ? 
$config->config_data['frontend_default_group'] : 0;
+                                               $group_lid = 
$GLOBALS['phpgw']->accounts->name2id($default_group_id);
+                                               $group_lid = $group_lid ? 
$group_lid : 'frontend_delegates';
+
+                                               $password = 'PEre' . mt_rand() 
. '&';
+                                               $account_id = 
frontend_bofrontend::create_delegate_account($account_lid, 
$fellesdata_user['firstname'], $fellesdata_user['lastname'], $password, 
$group_lid);
+                                       }
+                               }
+                       }
+               }
+       }

Modified: branches/Version-1_0-branch/frontend/inc/hook_config.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/inc/hook_config.inc.php        
2010-11-24 21:41:50 UTC (rev 6634)
+++ branches/Version-1_0-branch/frontend/inc/hook_config.inc.php        
2010-11-24 22:03:45 UTC (rev 6635)
@@ -106,6 +106,34 @@
        }
 
        /**
+       * Get HTML selectbox with user groups - which group to add autocreated 
users
+       *
+       * @param $config
+       * @return string options for selectbox
+       */
+       function frontend_default_group($config)
+       {
+               $groups = $GLOBALS['phpgw']->accounts->get_list('groups');
+               $group_assigned = isset($config['frontend_default_group']) ? 
$config['frontend_default_group'] : '';
+
+               $out = '<option value="">' . lang('none selected') . 
'</option>' . "\n";
+
+               foreach ( $groups as $group => $label)
+               {
+                       $selected = '';
+                       if ( $group_assigned == $group )
+                       {
+                               $selected = ' selected';
+                       }
+
+                       $out .=  <<<HTML
+                               <option 
value="{$group}"{$selected}>{$label}</option>
+HTML;
+               }
+               return $out;
+       }
+
+       /**
        * Get HTML listbox with categories that are candidates for the 
picture_building_cat
        *
        * @param $config

Modified: branches/Version-1_0-branch/frontend/setup/setup.inc.php
===================================================================
--- branches/Version-1_0-branch/frontend/setup/setup.inc.php    2010-11-24 
21:41:50 UTC (rev 6634)
+++ branches/Version-1_0-branch/frontend/setup/setup.inc.php    2010-11-24 
22:03:45 UTC (rev 6635)
@@ -34,5 +34,6 @@
        $setup_info['frontend']['hooks'] = array
        (
                'menu'  => 'frontend.menu.get_menu',
+               'auto_addaccount'       => 
'frontend.hook_helper.auto_addaccount',
                'config'
        );

Modified: branches/Version-1_0-branch/frontend/templates/base/config.tpl
===================================================================
--- branches/Version-1_0-branch/frontend/templates/base/config.tpl      
2010-11-24 21:41:50 UTC (rev 6634)
+++ branches/Version-1_0-branch/frontend/templates/base/config.tpl      
2010-11-24 22:03:45 UTC (rev 6635)
@@ -20,7 +20,24 @@
                         </table>
                        </td>
                </tr>
+               <tr class="row_on">
+                       <td>{lang_activate_autocreate_user}:</td>
+                       <td>
+                               <select name="newsettings[autocreate_user]">
+                                       <option value="" 
{selected_autocreate_user_}>NO</option>
+                                       <option value="1" 
{selected_autocreate_user_1}>YES</option>
+                               </select>
+                       </td>
+               </tr>
                <tr class="row_off">
+                       <td>{lang_frontend_default_group}:</td>
+                       <td>
+                        <select name="newsettings[frontend_default_group]">
+{hook_frontend_default_group}
+                        </select>
+                       </td>
+               </tr>
+               <tr class="row_on">
                        <td>{lang_ticket_default_group}:</td>
                        <td>
                         <select name="newsettings[tts_default_group]">
@@ -28,7 +45,7 @@
                         </select>
                        </td>
                </tr>
-               <tr class="row_on">
+               <tr class="row_off">
                        <td>{lang_ticket_default_category}:</td>
                        <td>
                                <select name="newsettings[tts_default_cat]">

Modified: branches/Version-1_0-branch/login.php
===================================================================
--- branches/Version-1_0-branch/login.php       2010-11-24 21:41:50 UTC (rev 
6634)
+++ branches/Version-1_0-branch/login.php       2010-11-24 22:03:45 UTC (rev 
6635)
@@ -73,11 +73,19 @@
                $login  = $_SERVER['PHP_AUTH_USER'];
                $passwd = $_SERVER['PHP_AUTH_PW'];
        }
-       
+
        if ($GLOBALS['phpgw_info']['server']['auth_type'] == 'ntlm' && 
isset($_SERVER['REMOTE_USER']) && (!isset($_REQUEST['skip_remote']) || 
!$_REQUEST['skip_remote']))
        {
                $login  = $_SERVER['REMOTE_USER'];
                $passwd = '';
+
+               $GLOBALS['hook_values'] = array
+               (
+                       'account_lid'   => $login
+               );
+
+               
$GLOBALS['phpgw']->hooks->process('auto_addaccount',array('frontend'));
+
 //------------------Start login ntlm
 
                $GLOBALS['sessionid'] = 
$GLOBALS['phpgw']->session->create($login, $passwd);

Modified: branches/Version-1_0-branch/rental/inc/class.socontract.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/class.socontract.inc.php     
2010-11-24 21:41:50 UTC (rev 6634)
+++ branches/Version-1_0-branch/rental/inc/class.socontract.inc.php     
2010-11-24 22:03:45 UTC (rev 6635)
@@ -108,6 +108,7 @@
                                        $like_clauses[] = "party.last_name 
$this->like $like_pattern";
                                        $like_clauses[] = "party.company_name 
$this->like $like_pattern";
                                        $like_clauses[] = "composite.name 
$this->like $like_pattern";
+                                       $like_clauses[] = "r_u.location_code 
$this->like $like_pattern";
                                        break;
                        }
                        




reply via email to

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