phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: infolog/inc class.boinfolog.inc.php,1.14.2.3,1.


From: Joseph Engo <address@hidden>
Subject: [Phpgroupware-cvs] CVS: infolog/inc class.boinfolog.inc.php,1.14.2.3,1.14.2.3.2.1 class.soinfolog.inc.php,1.10.2.1,1.10.2.1.2.1 class.uiinfolog.inc.php,1.30.2.12,1.30.2.12.2.1
Date: Wed, 26 Mar 2003 18:00:05 -0500

Update of /cvsroot/phpgroupware/infolog/inc
In directory subversions:/tmp/cvs-serv9126/inc

Modified Files:
      Tag: Version-0_9_16-branch
        class.boinfolog.inc.php class.soinfolog.inc.php 
        class.uiinfolog.inc.php 
Log Message:
- Quite a few bug fixes (I forgot most of them :)
- Fixes for XML-RPC
- Added an ACL option for edit assigned and delete assigned.  The delete option 
can be quite usefull for the person assigning the task to confirm its been 
completed before its deleted.


Index: class.boinfolog.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/infolog/inc/class.boinfolog.inc.php,v
retrieving revision 1.14.2.3
retrieving revision 1.14.2.3.2.1
diff -C2 -r1.14.2.3 -r1.14.2.3.2.1
*** class.boinfolog.inc.php     5 Nov 2002 15:57:13 -0000       1.14.2.3
--- class.boinfolog.inc.php     26 Mar 2003 23:00:03 -0000      1.14.2.3.2.1
***************
*** 43,46 ****
--- 43,90 ----
                var $send_file_ips = array();
  
+               function list_methods($_type='xmlrpc')
+               {
+                       /*
+                       **  This handles introspection or discovery by the 
logged in client,
+                       **  in which case the input might be an array.  The 
server always calls
+                       **  this function to fill the server dispatch map using 
a string.
+                       */
+ 
+                       if (is_array($_type))
+                       {
+                               $_type = $_type['type'] ? $_type['type'] : 
$_type[0];
+                       }
+ 
+                       switch($_type)
+                       {
+                               case 'xmlrpc':
+                                       $xml_functions = array(
+                                               'read' => array(
+                                                       'function'  => 'read',
+                                                       'signature' => 
array(array(xmlrpcStruct,xmlrpcStruct)),
+                                                       'docstring' => 
lang('Return the values of an item.')
+                                               ),
+                                               'list_id_numbers' => array(
+                                                       'function'  => 
'readIdArray',
+                                                       'signature' => 
array(array(xmlrpcStruct,xmlrpcStruct)),
+                                                       'docstring' => 
lang('Returns a list of info_id numbers.')
+                                               ),
+                                               'list_methods' => array(
+                                                       'function'  => 
'list_methods',
+                                                       'signature' => 
array(array(xmlrpcStruct,xmlrpcString)),
+                                                       'docstring' => 
lang('Read this list of methods.')
+                                               )
+                                       );
+                                       return $xml_functions;
+                                       break;
+                               case 'soap':
+                                       return $this->soap_functions;
+                                       break;
+                               default:
+                                       return array();
+                                       break;
+                       }
+               }
+ 
                function boinfolog( $info_id = 0)
                {
***************
*** 178,181 ****
--- 222,230 ----
                function read($info_id)
                {
+                       if (is_array($info_id))
+                       {
+                               $info_id = (int)$info_id['info_id'];
+                       }
+ 
                        $this->so->read($info_id);
                                
***************
*** 228,237 ****
                }
  
!               function 
readIdArray($order,$sort,$filter,$cat_id,$query,$action,$addr_id,
!                                                                       
$proj_id,$info_id,$ordermethod,&$start,&$total)
                {
!                       return 
$this->so->readIdArray($order,$sort,$filter,$cat_id,$query,
!                                                                               
                        $action,$addr_id,$proj_id,$info_id,
!                                                                               
                        $ordermethod,$start,$total);
                }
  
--- 277,294 ----
                }
  
!       
! 
!               function readIdArray($p)
                {
!                       return 
$this->so->readIdArray($p['order'],$p['sort'],$p['filter'],$p['cat_id'],$p['query'],
!                               
$p['action'],$p['addr_id'],$p['proj_id'],$p['info_id'],$p['ordermethod'],$p['start'],$p['total']);
! //print_r($r);
! 
! //            function 
readIdArray($order,$sort,$filter,$cat_id,$query,$action,$addr_id,
! //                                                                    
$proj_id,$info_id,$ordermethod,&$start,&$total)
! //            {
! //                    return 
$this->so->readIdArray($order,$sort,$filter,$cat_id,$query,
! //                                                                            
                        $action,$addr_id,$proj_id,$info_id,
! //                                                                            
                        $ordermethod,$start,$total);
                }
  

Index: class.soinfolog.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/infolog/inc/class.soinfolog.inc.php,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.1.2.1
diff -C2 -r1.10.2.1 -r1.10.2.1.2.1
*** class.soinfolog.inc.php     20 Nov 2002 19:54:03 -0000      1.10.2.1
--- class.soinfolog.inc.php     26 Mar 2003 23:00:03 -0000      1.10.2.1.2.1
***************
*** 57,61 ****
                                                         
!!($this->grants[$owner] & $required_rights) &&
                                                         ($info['info_access'] 
== 'public' ||
!                                                        
!!($this->grants[$owner] & PHPGW_ACL_PRIVATE));   
                                                        
                        // echo "check_access(info_id=$info_id (owner=$owner, 
user=$user),required_rights=$required_rights): 
access".($access_ok?"Ok":"Denied");
--- 57,62 ----
                                                         
!!($this->grants[$owner] & $required_rights) &&
                                                         ($info['info_access'] 
== 'public' ||
!                                                        
!!($this->grants[$owner] & PHPGW_ACL_PRIVATE) || 
$this->data['info_responsible'] == $user);  
!                       // echo '<p>user: ' . $user . '<br>responsible: ' . 
$this->data['info_responsible']; 
                                                        
                        // echo "check_access(info_id=$info_id (owner=$owner, 
user=$user),required_rights=$required_rights): 
access".($access_ok?"Ok":"Denied");
***************
*** 70,80 ****
                function aclFilter($filter = 'none')
                {
!                       ereg('.*(own|privat|all|none).*',$filter,$vars);
                        $filter = $vars[1];
  
                        if (isset($this->acl_filter[$filter]))
                        {
                                return $this->acl_filter[$filter];  // used 
cached filter if found
                        }
                        if (is_array($this->grants))
                        {
--- 71,83 ----
                function aclFilter($filter = 'none')
                {
!                       eregi('.*(own|privat|all|none).*',$filter,$vars);
                        $filter = $vars[1];
  
+ 
                        if (isset($this->acl_filter[$filter]))
                        {
                                return $this->acl_filter[$filter];  // used 
cached filter if found
                        }
+ 
                        if (is_array($this->grants))
                        {
***************
*** 100,104 ****
  
                        // private: own entries plus the one user is 
responsible for 
!                       if ($filter == 'private' || $filter == 'own')
                        {
                                $filtermethod .= " OR 
(info_responsible=$this->user OR info_status = 'offer')".
--- 103,107 ----
  
                        // private: own entries plus the one user is 
responsible for 
!                       if ($filter == 'private' || $filter == 'own' || $filter 
== 'none')
                        {
                                $filtermethod .= " OR 
(info_responsible=$this->user OR info_status = 'offer')".

Index: class.uiinfolog.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/infolog/inc/class.uiinfolog.inc.php,v
retrieving revision 1.30.2.12
retrieving revision 1.30.2.12.2.1
diff -C2 -r1.30.2.12 -r1.30.2.12.2.1
*** class.uiinfolog.inc.php     13 Mar 2003 14:19:17 -0000      1.30.2.12
--- class.uiinfolog.inc.php     26 Mar 2003 23:00:03 -0000      1.30.2.12.2.1
***************
*** 14,17 ****
--- 14,20 ----
        /* $Id$ */
  
+       define(INFOLOG_ACL_EDIT_ASSIGNED,PHPGW_ACL_CUSTOM_1);
+       define(INFOLOG_ACL_DELETE_ASSIGNED,PHPGW_ACL_CUSTOM_2);
+ 
        class uiinfolog         // UI - User Interface - HTML 
        {
***************
*** 331,334 ****
--- 334,344 ----
                        {
                                $filter = 
$GLOBALS['phpgw_info']['user']['preferences']['infolog']['defaultFilter'];
+ 
+                               // If they didn't select a filter durring list 
view, and don't have there preferences selected.
+                               // Use the default, which is none.  This allows 
a user who has items assigned to them, to be able to view them. (jengo)
+                               if (! $filter)
+                               {
+                                       $filter = 'none';
+                               }
                        }
  
***************
*** 400,406 ****
                        // -------------- end header declaration 
-----------------
  
!                       $ids = 
$this->bo->readIdArray($order,$sort,$filter,$cat_id,$query,
!                                                                               
                        $action,$addr_id,$proj_id,$info_id,
!                                                                               
                        $ordermethod,$start,$total);
  
                        $maxmatchs = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
--- 410,428 ----
                        // -------------- end header declaration 
-----------------
  
!                       $p = array(
!                               'order'       => $order,
!                               'sort'        => $sort,
!                               'filter'      => $filter,
!                               'cat_id'      => $cat_id,
!                               'query'       => $query,
!                               'action'      => $action,
!                               'addr_id'     => $addr_id,
!                               'proj_id'     => $proj_id,
!                               'info_id'     => $info_id,
!                               'ordermethod' => $ordermethod,
!                               'start'       => $start,
!                               'total'       => $total
!                       );
!                       $ids = $this->bo->readIdArray($p);
  
                        $maxmatchs = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
***************
*** 482,486 ****
                                $t->set_var( $this->formatInfo( 
$id,$proj_id,$addr_id ));
  
!                               if ($this->bo->check_access($id,PHPGW_ACL_EDIT))
                                {
                                        $t->set_var('edit',$html->a_href(
--- 504,509 ----
                                $t->set_var( $this->formatInfo( 
$id,$proj_id,$addr_id ));
  
!                               $item_data = $this->bo->read($id);
!                               if ($this->bo->check_access($id,PHPGW_ACL_EDIT) 
|| ($this->bo->check_access($id,INFOLOG_ACL_EDIT_ASSIGNED) && 
$GLOBALS['phpgw_info']['user']['account_id'] == $item_data['info_responsible']))
                                {
                                        $t->set_var('edit',$html->a_href(
***************
*** 496,500 ****
                                }
  
!                               if 
($this->bo->check_access($id,PHPGW_ACL_DELETE))
                                {
                                        $t->set_var('delete',$html->a_href(
--- 519,523 ----
                                }
  
!                               if 
($this->bo->check_access($id,PHPGW_ACL_DELETE) || 
($this->bo->check_access($id,INFOLOG_ACL_DELETE_ASSIGNED) && 
$GLOBALS['phpgw_info']['user']['account_id'] == $item_data['info_responsible']))
                                {
                                        $t->set_var('delete',$html->a_href(
***************
*** 654,659 ****
                }
  
  
!               function edit( )
                {
                        global 
$action,$info_id,$save,$add,$query_addr,$query_project;
--- 677,709 ----
                }
  
+               // This is just a short cut function to make the code a little 
easier to read in certain parts
+               // This should be moved to bo in the future for XML-RPC 
realated calls. (jengo)
+               function can_edit($id, $responsible)
+               {
+                       if 
($this->bo->check_access($id,INFOLOG_ACL_EDIT_ASSIGNED) && 
$GLOBALS['phpgw_info']['user']['account_id'] == $responsible)
+                       {
+                               return True;
+                       }
+               }
+ 
+               // This is just a short cut function to make the code a little 
easier to read in certain parts
+               // This should be moved to bo in the future for XML-RPC 
realated calls. (jengo)
+               function can_delete($id, $responsible)
+               {
+                         $permission_to_delete = False;
+                         if ($this->bo->check_access($id,PHPGW_ACL_DELETE))
+                         {
+                                 $permission_to_delete = True;
+                         }
+ 
+                         if 
($this->bo->check_access($id,INFOLOG_ACL_DELETE_ASSIGNED) && 
$GLOBALS['phpgw_info']['user']['account_id'] == $responsible)
+                         {
+                                 $permission_to_delete = True;
+                         }
  
!                       return $permission_to_delete;
!               }
! 
!               function edit()
                {
                        global 
$action,$info_id,$save,$add,$query_addr,$query_project;
***************
*** 669,678 ****
  
                        $referer = $this->get_referer();
  
!                       if ((!isset($info_id) || !$info_id) && !$action || 
$GLOBALS['HTTP_POST_VARS']['cancel'])
                        {
                                Header('Location: ' . $html->link($referer) );
                        }
!                       if ($GLOBALS['HTTP_POST_VARS']['delete'])
                        {
                                Header('Location: ' . 
$html->link('/index.php',$this->menuaction('delete')+
--- 719,740 ----
  
                        $referer = $this->get_referer();
+ //                    $action  = ($GLOBALS['HTTP_POST_VARS']['action'] ? 
$GLOBALS['HTTP_POST_VARS']['action'] : $GLOBALS['HTTP_GET_VARS']['action']);
+ //                    $save    = $GLOBALS['HTTP_GET_VARS']['save'];
  
!                       if ((!isset($info_id) || !$info_id) && !$action || 
$cancel)
                        {
+ /*
+ echo '<p>info_id: ' . $info_id;
+ echo '<br>action: ' . $action;
+ echo '<br>cancel: ' . $cancel;
+ echo '<br>add: ' . $add;
+ echo '<br>save: ' . $save;
+ echo '<br>loop?';
+ echo '<pre>'; print_r($GLOBALS); echo '</pre>';
+ */
                                Header('Location: ' . $html->link($referer) );
                        }
! 
!                       if ($delete)
                        {
                                Header('Location: ' . 
$html->link('/index.php',$this->menuaction('delete')+
***************
*** 741,744 ****
--- 803,808 ----
                                }
                        }
+ 
+                       $this->bo->read($info_id);
                        if ($save || $add)              // form submited
                        {
***************
*** 764,775 ****
                                        **      if an info_id exists, check if 
this user hast the rights to edit
                                        **      this entry (should prevent 
faking the info_id in a post request)
!                                       **      or if is a new sub check if he 
has rights to add a sub
                                        */
!                                       if ($info_id && 
!$this->bo->check_access($info_id,PHPGW_ACL_EDIT) ||
!                                           !$info_id && $id_parent && 
!$this->bo->check_access($id_parent,PHPGW_ACL_ADD))
!                                       {
!                                               $error[]=lang('Access denied');
!                                       }
!                                       else
                                        {
                                                $this->bo->write(array(
--- 828,837 ----
                                        **      if an info_id exists, check if 
this user hast the rights to edit
                                        **      this entry (should prevent 
faking the info_id in a post request)
!                                       **      or if is a new sub check if he 
has rights to add a sub or
!                                       **      if the person responsiable for 
the item is the current user
!                                       **      and they are allowed to edit 
items assigned to them
                                        */
!                                       if (! $info_id || ($info_id && 
$this->bo->check_access($info_id,PHPGW_ACL_EDIT) || 
$this->can_edit($info_id,$this->bo->so->data['info_responsible']) || 
$this->bo->check_access($id_parent,PHPGW_ACL_ADD)))
! 
                                        {
                                                $this->bo->write(array(
***************
*** 801,804 ****
--- 863,870 ----
                                                }
                                        }
+                                       else
+                                       {
+                                               $error[] = lang('Access 
denied');
+                                       }
  
                                        if (!$query_addr && !$query_project)
***************
*** 810,815 ****
                                $access = $access == 'private'; // else after 
an error the entry is private
                        }
!                       $this->bo->read( $info_id );
! 
                        if ($info_id && $action == 'sp')    // new SubProject
                        {
--- 876,880 ----
                                $access = $access == 'private'; // else after 
an error the entry is private
                        }
!                       //$this->bo->read( $info_id );
                        if ($info_id && $action == 'sp')    // new SubProject
                        {
***************
*** 846,853 ****
                                if ($info_id && 
!$this->bo->check_access($info_id,PHPGW_ACL_EDIT))
                                {
!                                       Header('Location: ' .  
$html->link($referer));
!                                       $GLOBALS['phpgw']->common->phpgw_exit();
                                }
                        }
                        if (!$id_parent)
                                $id_parent = 
$this->bo->so->data['info_id_parent'];
--- 911,922 ----
                                if ($info_id && 
!$this->bo->check_access($info_id,PHPGW_ACL_EDIT))
                                {
!                                       if 
($GLOBALS['phpgw_info']['user']['account_id'] != 
$this->bo->so->data['info_responsible'] || ! 
$this->bo->check_access($info_id,INFOLOG_ACL_EDIT_ASSIGNED))
!                                       {
!                                               Header('Location: ' .  
$html->link($referer));
!                                               
$GLOBALS['phpgw']->common->phpgw_exit();
!                                       }
                                }
                        }
+ 
                        if (!$id_parent)
                                $id_parent = 
$this->bo->so->data['info_id_parent'];
***************
*** 873,876 ****
--- 942,946 ----
                        $t->set_block('info_edit', 'edit', 'edithandle');
                        $t->set_block('info_edit', 'subpro', 'subprohandle');
+                       
$t->set_block('info_edit','project_button','project_button_handle');
  
                        if (is_array($error))
***************
*** 996,999 ****
--- 1066,1075 ----
                        $t->set_var('addhandle','');
                        $t->set_var('subprohandle','');
+ 
+                       if ($GLOBALS['phpgw']->acl->check('run',1,'projects'))
+                       {
+                               
$t->fp('project_button_handle','project_button');
+                       }
+ 
                        $t->pfp('out','info_edit');
                        $t->pfp('edithandle','edit');
***************
*** 1008,1017 ****
                        $referer = $this->get_referer();
  
!                       if (!$info_id ||
!                           !$this->bo->check_access($info_id,PHPGW_ACL_DELETE))
                        {
                                Header('Location: ' .  $html->link($referer));
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
                        if ($confirm)
                        {
--- 1084,1097 ----
                        $referer = $this->get_referer();
  
!                       $this->bo->read($info_id);
!                       $assigned_to = $this->bo->so->data['info_responsible'];
! 
!                       if (! $this->can_delete($info_id,$assigned_to))
                        {
+ 
                                Header('Location: ' .  $html->link($referer));
                                $GLOBALS['phpgw']->common->phpgw_exit();
                        }
+ 
                        if ($confirm)
                        {





reply via email to

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