phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] admin/inc class.boaccounts.inc.php, 1.22.2.7.2.11, 1


From: Alejandro Borges (lex) <address@hidden>
Subject: [Phpgroupware-cvs] admin/inc class.boaccounts.inc.php, 1.22.2.7.2.11, 1.22.2.7.2.12 class.boaclmanager.inc.php, 1.2.4.1, 1.2.4.2 class.uiaccounts.inc.php, 1.23.2.9.2.22, 1.23.2.9.2.23 class.uiaclmanager.inc.php, 1.5.2.2.2.2, 1.5.2.2.2.3
Date: Sun, 26 Oct 2003 03:24:45 +0000

Update of /cvsroot/phpgroupware/admin/inc
In directory subversions:/tmp/cvs-serv11274/admin/inc

Modified Files:
      Tag: Version-0_9_16-branch
        class.boaccounts.inc.php class.boaclmanager.inc.php 
        class.uiaccounts.inc.php class.uiaclmanager.inc.php 
Log Message:
Addressmaster fixup.... one more is pending, this one is known to crash apache 
in large pgsql updates from 14


Index: class.uiaclmanager.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.uiaclmanager.inc.php,v
retrieving revision 1.5.2.2.2.2
retrieving revision 1.5.2.2.2.3
diff -C2 -d -r1.5.2.2.2.2 -r1.5.2.2.2.3
*** class.uiaclmanager.inc.php  23 Oct 2003 15:26:36 -0000      1.5.2.2.2.2
--- class.uiaclmanager.inc.php  26 Oct 2003 03:24:42 -0000      1.5.2.2.2.3
***************
*** 195,214 ****
                        
$GLOBALS['phpgw']->template->set_var('lang_done',lang('done'));
                        $admins = $this->boacl->list_accountmasters();
! 
                        //_debug_array($admins);
!                       for ($i=0;$i<count($admins);$i++)
                        {
!                               
$this->nextmatchs->template_alternate_row_color(&$GLOBALS['phpgw']->template);
! 
!                               $GLOBALS['phpgw']->template->set_var(array
!                               (
!                                       'lid'           => $admins[$i]['lid'],
!                                       'firstname'     => 
$admins[$i]['firstname'],
!                                       'lastname'      => 
$admins[$i]['lastname'])
!                               );
  
!                               
$GLOBALS['phpgw']->template->fp('list','admin_list',True);
                        }
- 
                        
$GLOBALS['phpgw']->template->pfp('out','admin_list_t',True);
                }
--- 195,216 ----
                        
$GLOBALS['phpgw']->template->set_var('lang_done',lang('done'));
                        $admins = $this->boacl->list_accountmasters();
!                       
                        //_debug_array($admins);
!                       if(is_array($admins))
                        {
!                               foreach($admins as $admin)
!                               {
!                                       
$this->nextmatchs->template_alternate_row_color(&$GLOBALS['phpgw']->template);
!                                       
!                                       
$GLOBALS['phpgw']->template->set_var(array
!                                                                            (
!                                                                               
     'lid'              => $admin['lid'],
!                                                                               
     'firstname'        => $admin['firstname'],
!                                                                               
     'lastname' => $admin['lastname'])
!                                               );
  
!                                       
$GLOBALS['phpgw']->template->fp('list','admin_list',True);
!                               }
                        }
                        
$GLOBALS['phpgw']->template->pfp('out','admin_list_t',True);
                }
***************
*** 229,233 ****
                        if ($_POST['save'])
                        {
!                               
$this->boacl->edit_accountmasters($_POST['account_users']);
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
--- 231,235 ----
                        if ($_POST['save'])
                        {
!                               
$this->boacl->edit_accountmasters($_POST['account_addressmaster'], 
$_POST['account_user']);
                                
$GLOBALS['phpgw']->redirect_link('/index.php',$link_data);
                        }
***************
*** 246,250 ****
                        
$GLOBALS['phpgw']->template->set_block('admin_add','popwin');
  
!                       
$GLOBALS['phpgw']->template->set_var('lang_select_accountmasters',lang('select 
accountmasters'));
                        
$GLOBALS['phpgw']->template->set_var('lang_save',lang('save'));
                        
$GLOBALS['phpgw']->template->set_var('lang_cancel',lang('cancel'));
--- 248,253 ----
                        
$GLOBALS['phpgw']->template->set_block('admin_add','popwin');
  
!                       
$GLOBALS['phpgw']->template->set_var('lang_set_accountmaster',lang('Set 
accountmaster'));
!                       
$GLOBALS['phpgw']->template->set_var('lang_select_accountmasters',lang('Select 
accountmasters list'));
                        
$GLOBALS['phpgw']->template->set_var('lang_save',lang('save'));
                        
$GLOBALS['phpgw']->template->set_var('lang_cancel',lang('cancel'));
***************
*** 276,293 ****
                                $account_num = count($account_list);
  
                                $user_list = '';
!                               while (list($key,$entry) = each($account_list))
!                               {
!                                       $user_list .= '<option value="' . 
$entry['account_id'] . '"'
!                                       . 
$group_info['account_user'][intval($entry['account_id'])] . '>'
!                                       . 
$GLOBALS['phpgw']->common->display_fullname(
!                                               $entry['account_lid'],
!                                               $entry['account_firstname'],
!                                               $entry['account_lastname'])
!                                       . '</option>'."\n";
!                               }
                                
$GLOBALS['phpgw']->template->set_var('select_size',($account_num < 
7?$account_num:7));
                                
$GLOBALS['phpgw']->template->set_var('user_list',$user_list);
!                               
$GLOBALS['phpgw']->template->fp('admin_add','select',True);
                        }
  
--- 279,294 ----
                                $account_num = count($account_list);
  
+                               $addressmaster = 
$GLOBALS['phpgw_info']['server']['addressmaster'];
                                $user_list = '';
!                               $user_list = 
$this->get_select_user_list($account_list, array($addressmaster));
                                
$GLOBALS['phpgw']->template->set_var('select_size',($account_num < 
7?$account_num:7));
                                
$GLOBALS['phpgw']->template->set_var('user_list',$user_list);
! 
!                               $admins = $this->boacl->list_accountmasters();
!                               $user_list = 
$this->get_select_user_list($account_list, array_keys($admins));
!                               
$GLOBALS['phpgw']->template->set_var('account_list',$user_list);
!                               $select = 
$GLOBALS['phpgw']->template->fp('out','select', True);
!                               
$GLOBALS['phpgw']->template->set_var('accounts', $select);
!                               
//$GLOBALS['phpgw']->template->fp('admin_add','accounts',True);
                        }
  
***************
*** 296,298 ****
--- 297,329 ----
                        $GLOBALS['phpgw']->template->pfp('out','admin_add');
                }
+ 
+               function get_select_user_list($user_list, $options=array())
+               {
+                       if(!is_array($options))
+                       {
+                               $options=array();
+                       }
+                       
+                       foreach($user_list as $entry)
+                       {
+                               if(in_array($entry['account_id'], $options))
+                               {
+                                       $selected = 'selected';
+                               }
+                               else
+                               {
+                                       $selected = '';
+                               }
+                               
+                               $user_list .= '<option value="' . 
$entry['account_id'] . '"'
+                                       . $selected . '>'
+                                       . 
$GLOBALS['phpgw']->common->display_fullname(
+                                               $entry['account_lid'],
+                                               $entry['account_firstname'],
+                                               $entry['account_lastname'])
+                                       . '</option>'."\n";
+                       }
+                       return $user_list;
+               }
        }
+ ?>

Index: class.uiaccounts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.uiaccounts.inc.php,v
retrieving revision 1.23.2.9.2.22
retrieving revision 1.23.2.9.2.23
diff -C2 -d -r1.23.2.9.2.22 -r1.23.2.9.2.23
*** class.uiaccounts.inc.php    23 Oct 2003 15:26:36 -0000      1.23.2.9.2.22
--- class.uiaccounts.inc.php    26 Oct 2003 03:24:41 -0000      1.23.2.9.2.23
***************
*** 1129,1135 ****
                        if($_account_id)
                        {
                                $grants = 
$GLOBALS['phpgw']->acl->get_grants('addressbook');
!                               $addressmaster = 
$GLOBALS['phpgw']->accounts->name2id('addressmaster');
!                               if (!!($grants[$addressmaster] & 
PHPGW_ACL_EDIT))
                                {
                                        $referer = 
$GLOBALS['phpgw']->link('/index.php', 
--- 1129,1135 ----
                        if($_account_id)
                        {
+                               $owner = 
$GLOBALS['phpgw_info']['server']['addressmaster'];
                                $grants = 
$GLOBALS['phpgw']->acl->get_grants('addressbook');
!                               if (!!($grants[$owner] & PHPGW_ACL_EDIT))
                                {
                                        $referer = 
$GLOBALS['phpgw']->link('/index.php', 

Index: class.boaccounts.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.boaccounts.inc.php,v
retrieving revision 1.22.2.7.2.11
retrieving revision 1.22.2.7.2.12
diff -C2 -d -r1.22.2.7.2.11 -r1.22.2.7.2.12
*** class.boaccounts.inc.php    17 Oct 2003 05:26:34 -0000      1.22.2.7.2.11
--- class.boaccounts.inc.php    26 Oct 2003 03:24:41 -0000      1.22.2.7.2.12
***************
*** 344,348 ****
                                {
                                        //jarg-SOG S
!                                       $owner = 
$GLOBALS['phpgw']->accounts->name2id('addressmaster');
                                        $contacts = 
CreateObject('phpgwapi.contacts');
                                        $type = 
$contacts->search_contact_type('Persons');
--- 344,349 ----
                                {
                                        //jarg-SOG S
!                                       //$owner = 
$GLOBALS['phpgw']->accounts->name2id('addressmaster');
!                                       $owner = 
$GLOBALS['phpgw_info']['server']['addressmaster'];
                                        $contacts = 
CreateObject('phpgwapi.contacts');
                                        $type = 
$contacts->search_contact_type('Persons');
***************
*** 357,362 ****
                                        $account_id = 
$this->so->add_user($userData);
  
-                                       
$GLOBALS['phpgw']->acl->add_repository('addressbook',$account_id,$owner,1);
-                                       
                                        if ($userData['anonymous'])
                                        {
--- 358,361 ----
***************
*** 781,789 ****
  
                        /* check that addressmaster record exist */
!                       if 
(!$GLOBALS['phpgw']->accounts->exists('addressmaster') && 
$_userData['account_lid'] != 'addressmaster')
!                       {
!                               $error[$totalerrors] = lang('You have not the 
addressmaster record');
!                               $totalerrors++;
!                       }
                        
                        
--- 780,788 ----
  
                        /* check that addressmaster record exist */
! //                    if 
(!$GLOBALS['phpgw']->accounts->exists('addressmaster') && 
$_userData['account_lid'] != 'addressmaster')
! //                    {
! //                            $error[$totalerrors] = lang('You have not the 
addressmaster record');
! //                            $totalerrors++;
! //                    }
                        
                        
***************
*** 802,806 ****
                {
                        //jarg-SOG S
!                       $owner = 
$GLOBALS['phpgw']->accounts->name2id('addressmaster');
                        if($_userData['account_id'] != $owner)
                        {
--- 801,806 ----
                {
                        //jarg-SOG S
!                       //$owner = 
$GLOBALS['phpgw']->accounts->name2id('addressmaster');
!                       $owner = 
$GLOBALS['phpgw_info']['server']['addressmaster'];
                        if($_userData['account_id'] != $owner)
                        {

Index: class.boaclmanager.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/admin/inc/class.boaclmanager.inc.php,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -C2 -d -r1.2.4.1 -r1.2.4.2
*** class.boaclmanager.inc.php  23 Oct 2003 15:26:35 -0000      1.2.4.1
--- class.boaclmanager.inc.php  26 Oct 2003 03:24:41 -0000      1.2.4.2
***************
*** 46,68 ****
                function list_accountmasters()
                {
!                       $acc = 
$GLOBALS['phpgw']->acl->read_specific(array('type' => 
'applocation','acl_location' => 'accountmaster'));
!                       $this->total = $GLOBALS['phpgw']->acl->total;
  
                        //_debug_array($acc);
- 
                        while(is_array($acc) && list(,$val) = each($acc))
                        {
!                               $acc_name = 
$GLOBALS['phpgw']->accounts->get_account_data($val['account']);
!                               $data[] = array
!                               (
!                                       'account_id'    => $val['account'],
!                                       'lid'                   => 
$acc_name[$val['account']]['lid'],
!                                       'firstname'             => 
$acc_name[$val['account']]['firstname'],
!                                       'lastname'              => 
$acc_name[$val['account']]['lastname']
!                               );
                        }
                        return $data;
                }
  
                function get_acl_accounts()
                {
--- 46,76 ----
                function list_accountmasters()
                {
!                       $acc = $GLOBALS['phpgw']->acl->get_location_list_for_id(
!                               'addressbook', 
!                               PHPGW_ACL_READ + 
!                               PHPGW_ACL_ADD + 
!                               PHPGW_ACL_EDIT, 
!                               
$GLOBALS['phpgw_info']['server']['addressmaster']);
  
+                       $data = array();
                        //_debug_array($acc);
                        while(is_array($acc) && list(,$val) = each($acc))
                        {
!                               if(intval($val))
!                               {
!                                       $acc_name = 
$GLOBALS['phpgw']->accounts->get_account_data($val);
!                                       $data[$val] = array(
!                                               'account_id'            => $val,
!                                               'lid'                   => 
$acc_name[$val]['lid'],
!                                               'firstname'             => 
$acc_name[$val]['firstname'],
!                                               'lastname'              => 
$acc_name[$val]['lastname']
!                                               );
!                               }
                        }
+                       $this->total = count($data);
                        return $data;
                }
  
+               
                function get_acl_accounts()
                {
***************
*** 70,75 ****
                }
  
!               function edit_accountmasters($values)
                {
                }
        }
--- 78,124 ----
                }
  
!               function set_addressmaster($master)
                {
+                       // maybe:
+                       // $contacts->set_addressmaster($master) or
+                       $GLOBALS['phpgw']->accounts->set_addressmaster($master);
+               }
+ 
+               function edit_accountmasters($master, $values)
+               {
+                       // One addressmaster es required for owner field on 
contacts records.
+                       // This is the master.
+                       if(intval($master) < 1)
+                       {
+                               return;
+                       }
+                       $old_master = 
$GLOBALS['phpgw_info']['server']['addressmaster'];
+ 
+                       $this->set_addressmaster($master);
+ 
+                       $acc = $GLOBALS['phpgw']->acl->get_location_list_for_id(
+                               'addressbook', 
+                               PHPGW_ACL_READ + 
+                               PHPGW_ACL_ADD + 
+                               PHPGW_ACL_EDIT, 
+                               $old_master);
+                       
+                       while(is_array($acc) && list(,$location) = each($acc))
+                       {
+                               
$GLOBALS['phpgw']->acl->delete_repository('addressbook', $location, 
$old_master);
+                       }
+                       
+                       if(is_array($values))
+                       {
+                               foreach($values as $account)
+                               {
+                                       
$GLOBALS['phpgw']->acl->add_repository('addressbook', 
+                                                                              
$account, 
+                                                                              
$master, 
+                                                                              
PHPGW_ACL_READ + 
+                                                                              
PHPGW_ACL_ADD + 
+                                                                              
PHPGW_ACL_EDIT);
+                               }
+                       }
                }
        }





reply via email to

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