phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] api class.account_mgr.php, 1.1.2.27, 1.1.2.28 class.a


From: Joseph Engo <address@hidden>
Subject: [Phpgroupware-cvs] api class.account_mgr.php, 1.1.2.27, 1.1.2.28 class.acl.php, 1.1.1.1.2.5, 1.1.1.1.2.6 class.acl_mgr.php, 1.1.2.2, 1.1.2.3 class.admin.php, 1.1.2.18, 1.1.2.19 class.history.php, 1.1.2.5, 1.1.2.6 class.setup.php, 1.1.1.1.2.12, 1.1.1.1.2.13 core_functions.inc.php, 1.1.1.1.2.15, 1.1.1.1.2.16
Date: Mon, 01 Dec 2003 07:36:37 +0000

Update of /cvsroot/phpgroupware/api
In directory subversions:/tmp/cvs-serv27735/api

Modified Files:
      Tag: proposal-branch
        class.account_mgr.php class.acl.php class.acl_mgr.php 
        class.admin.php class.history.php class.setup.php 
        core_functions.inc.php 
Log Message:
- Added a possiable table structure for acl_locations
  *You will have to re-create your tables for this*
- Create account will show the basic ACL locations
- Added a few example acl_locations and a few actual working ones


Index: class.acl.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/class.acl.php,v
retrieving revision 1.1.1.1.2.5
retrieving revision 1.1.1.1.2.6
diff -C2 -d -r1.1.1.1.2.5 -r1.1.1.1.2.6
*** class.acl.php       3 Nov 2003 17:31:20 -0000       1.1.1.1.2.5
--- class.acl.php       1 Dec 2003 07:36:34 -0000       1.1.1.1.2.6
***************
*** 408,412 ****
                        return $this->bit_check($rights,$args['required']);     
                
                }
!               
                /* I dont feel this function will be needed, and plan to remove 
it when certain.
                function check_op()
--- 408,431 ----
                        return $this->bit_check($rights,$args['required']);     
                
                }
! 
!               // This should only be used when accounts are deleted.
!               function delete_account_rights()
!               {
!                       $args = new safe_args();
!                       $args->set('account_id','##REQUIRED##','number');
!                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
! 
!                       if ($args['account_id'] == 
$GLOBALS['phpgw']['user']['id'])
!                       {
!                               $GLOBALS['msgbox']->add(lang('You can not 
delete your own ACL'),__LINE__,__FILE__, 'warning');
!                               return False;
!                       }
! 
!                       $this->db->query("delete from phpgw_acl where 
acl_account='" . $args['account_id'] . "'",__LINE__,__FILE__);
!                       $this->db->next_record();
! 
!                       return $this->db->affected_rows();
!               }
! 
                /* I dont feel this function will be needed, and plan to remove 
it when certain.
                function check_op()

Index: class.setup.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/class.setup.php,v
retrieving revision 1.1.1.1.2.12
retrieving revision 1.1.1.1.2.13
diff -C2 -d -r1.1.1.1.2.12 -r1.1.1.1.2.13
*** class.setup.php     1 Dec 2003 06:17:42 -0000       1.1.1.1.2.12
--- class.setup.php     1 Dec 2003 07:36:34 -0000       1.1.1.1.2.13
***************
*** 337,340 ****
--- 337,362 ----
                                                                       'status' 
=> 'Installed'
                                        );
+ 
+                                       foreach ($data['acl_locations'] as $key 
=> $acl_location)
+                                       {
+                                               if (count($acl_location) == 3)
+                                               {
+                                                       $al = $acl_location;
+                                                       
$GLOBALS['phpgw']->db->query("insert into phpgw_acl_locations 
(loc_op,loc_title,loc_value) values ('"
+                                                               . $al['op'] . 
"','" . addslashes($al['title']) . "','" . $al['value']
+                                                               . 
"')",__LINE__,__FILE__);
+                                               }
+                                               else
+                                               {
+                                                       $total = 
count($acl_location);
+                                                       for ($i=0; $i<$total; 
$i++)
+                                                       {
+                                                               $al = 
$acl_location[$i];
+                                                               
$GLOBALS['phpgw']->db->query("insert into phpgw_acl_locations 
(loc_op,loc_title,loc_value) values ('"
+                                                                       . 
$al['op'] . "','" . addslashes($al['title']) . "','" . $al['value']
+                                                                       . 
"')",__LINE__,__FILE__);
+                                                       }
+                                               }
+                                       }
                                }
                                else

Index: class.acl_mgr.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/Attic/class.acl_mgr.php,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** class.acl_mgr.php   17 Nov 2003 23:39:06 -0000      1.1.2.2
--- class.acl_mgr.php   1 Dec 2003 07:36:34 -0000       1.1.2.3
***************
*** 51,57 ****
--- 51,60 ----
        class api_acl_mgr
        {
+               var $db;
+ 
                function api_acl_mgr()
                {
                        $GLOBALS['phpgw']->add_xsl('api.acl_mgr');
+                       $this->db = $GLOBALS['phpgw']->db;
                }
  
***************
*** 232,240 ****
                }
  
-               // This is just a temp function for now
                function basic()
                {
!                       $_result = $this->account();
!                       $result  = $_result['acl_options'];
  
                        return $result;
--- 235,251 ----
                }
  
                function basic()
                {
!                       $this->db->query("select * from phpgw_acl_locations 
where loc_op not like '%.%.%' order by loc_title",__LINE__,__FILE__);
!                       while ($this->db->next_record())
!                       {
!                               if 
($GLOBALS['phpgw']->acl->check($this->db->f('loc_op'),$this->db->f('loc_value'),1))
!                               {
!                                       $result[] = array(
!                                               'op'    => 
$this->db->f('loc_op'),
!                                               'title' => 
lang($this->db->f('loc_title'))
!                                       );
!                               }
!                       }
  
                        return $result;

Index: class.account_mgr.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/Attic/class.account_mgr.php,v
retrieving revision 1.1.2.27
retrieving revision 1.1.2.28
diff -C2 -d -r1.1.2.27 -r1.1.2.28
*** class.account_mgr.php       19 Nov 2003 20:44:26 -0000      1.1.2.27
--- class.account_mgr.php       1 Dec 2003 07:36:34 -0000       1.1.2.28
***************
*** 101,104 ****
--- 101,106 ----
        class api_account_mgr
        {
+               var $db;
+ 
                function api_account_mgr()
                {
***************
*** 111,116 ****
--- 113,120 ----
  
                                $GLOBALS['phpgw']->add_xsl('api.account_mgr');
+                               $GLOBALS['phpgw']->add_xsl('api.widgets');
                                $GLOBALS['api_account_mgr_menus_loaded'] = True;
                        }
+                       $this->db = $GLOBALS['phpgw']->db;
                }
  
***************
*** 161,164 ****
--- 165,169 ----
                        $args->set('account_password', '##NOTSET##', 'any');
                        $args->set('account_password_confirm', '##NOTSET##', 
'any');
+                       $args->set('acl_allow',array(),'any');
                        $args = $args->get(func_get_args(),__LINE__,__FILE__);
  
***************
*** 210,214 ****
                                        
$result['missing_fields']['account_password_confirm'] = True;
                                        $GLOBALS['msgbox']->add(lang('The 
passwords you entered do not match'),__LINE__,__FILE__, 'notice');
- 
                                }
                                else
--- 215,218 ----
***************
*** 233,237 ****
                                        if ($account_id)
                                        {
!                                               
$GLOBALS['msgbox']->add(lang('Account has been created 
successfully'),__LINE__,__FILE__, 'notice');
                                                unset($result);
  
--- 237,251 ----
                                        if ($account_id)
                                        {
!                                               $acl = 
createObject('api_acl',$account_id);
!                                               foreach ($args['acl_allow'] as 
$key => $value)
!                                               {
!                                                       
$this->db->query("select loc_value from phpgw_acl_locations where 
loc_op='$key'",__LINE__,__FILE__);
!                                                       
$this->db->next_record();
! 
! //                                                    if 
($this->db->num_rows() && 
$GLOBALS['phpgw']->acl->check($key,$this->db->f('loc_value'),$this->db->f('loc_value')))
! //                                                    {
!                                                               
$acl->set($key,$this->db->f('loc_value'),0,1);
! //                                                    }
!                                               }
                                                unset($result);
  
***************
*** 242,245 ****
--- 256,260 ----
                                                $obj = 
createObject('api_history');
                                                $obj->set('api.accounts.' . 
$account_id,$history_data,array());
+                                               
$GLOBALS['msgbox']->add(lang('Account has been created 
successfully'),__LINE__,__FILE__, 'notice');
                                        }
                                }
***************
*** 451,461 ****
                        else if ($args['answer'] == 'Yes')
                        {
!                               if 
($GLOBALS['phpgw']->accounts->delete($args['account_id']))
                                {
!                                       
execMethod('api.history.clear','api.accounts.' . $args['account_id']);
                                        $GLOBALS['msgbox']->add(lang('The user 
%s has been deleted successfully',$account_lid),__LINE__,__FILE__, 'notice');
                                }
                                else
                                {
                                        $GLOBALS['msgbox']->add(lang('There was 
a problem deleting the account %s',$account_lid),__LINE__,__FILE__, 'warning');
                                }
--- 466,487 ----
                        else if ($args['answer'] == 'Yes')
                        {
!                               // We need everything here to be in the same 
transaction block
!                               $GLOBALS['phpgw']->accounts->db = 
&$GLOBALS['phpgw']->db;
!                               $GLOBALS['phpgw']->acl->db      = 
&$GLOBALS['phpgw']->db;
!                               $GLOBALS['phpgw']->history->db  = 
&$GLOBALS['phpgw']->db;
! 
!                               $GLOBALS['phpgw']->db->transaction_begin();
!                               $account_result                 = 
$GLOBALS['phpgw']->accounts->delete($args['account_id']);
!                               $acl_result                     = 
$GLOBALS['phpgw']->acl->delete_account_rights($args['account_id']);
!                               $history_result                 = 
execMethod('api.history.clear','api.accounts.' . $args['account_id']);
! 
!                               if ($account_result && $acl_result && 
$history_result)
                                {
!                                       
$GLOBALS['phpgw']->db->transaction_commit();
                                        $GLOBALS['msgbox']->add(lang('The user 
%s has been deleted successfully',$account_lid),__LINE__,__FILE__, 'notice');
                                }
                                else
                                {
+                                       
$GLOBALS['phpgw']->db->transaction_abort();
                                        $GLOBALS['msgbox']->add(lang('There was 
a problem deleting the account %s',$account_lid),__LINE__,__FILE__, 'warning');
                                }

Index: core_functions.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/core_functions.inc.php,v
retrieving revision 1.1.1.1.2.15
retrieving revision 1.1.1.1.2.16
diff -C2 -d -r1.1.1.1.2.15 -r1.1.1.1.2.16
*** core_functions.inc.php      24 Nov 2003 02:19:09 -0000      1.1.1.1.2.15
--- core_functions.inc.php      1 Dec 2003 07:36:35 -0000       1.1.1.1.2.16
***************
*** 95,101 ****
                                if(isset($val['duration']))
                                {
                                        $contents .= $key.": 
".$val['duration']."\n";
!                               }       
                        }
                        if (file_exists($this->filename) &&  
!is_writable($this->filename))
                        {
--- 95,105 ----
                                if(isset($val['duration']))
                                {
+                                       $total    += $val['duration'];
                                        $contents .= $key.": 
".$val['duration']."\n";
!                               }
                        }
+                       $contents .= "______________________\n";
+                       $contents .= "Total: $total\n";
+ 
                        if (file_exists($this->filename) &&  
!is_writable($this->filename))
                        {
***************
*** 111,115 ****
                                return;
                        }
!       fclose($handle);
                }
        }
--- 115,120 ----
                                return;
                        }
!                       fclose($handle);
!                       echo "\n<!--\n" . $contents . "-->\n";
                }
        }

Index: class.history.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/Attic/class.history.php,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** class.history.php   17 Nov 2003 23:39:06 -0000      1.1.2.5
--- class.history.php   1 Dec 2003 07:36:34 -0000       1.1.2.6
***************
*** 155,158 ****
--- 155,159 ----
  
                        $this->db->query("delete from phpgw_history where 
history_location='" . $args['location'] . "'",__LINE__,__FILE__);
+                       $this->db->next_record();
  
                        return $this->db->affected_rows();

Index: class.admin.php
===================================================================
RCS file: /cvsroot/phpgroupware/api/Attic/class.admin.php,v
retrieving revision 1.1.2.18
retrieving revision 1.1.2.19
diff -C2 -d -r1.1.2.18 -r1.1.2.19
*** class.admin.php     21 Nov 2003 01:00:16 -0000      1.1.2.18
--- class.admin.php     1 Dec 2003 07:36:34 -0000       1.1.2.19
***************
*** 53,56 ****
--- 53,57 ----
                {
                        $GLOBALS['phpgw']->add_xsl('api.admin');
+                       $GLOBALS['phpgw']->add_xsl('api.widgets');
  
                        $GLOBALS['phpgw']->add_appmenu('Admin menu','Add 
user','api.account_mgr.create');





reply via email to

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