phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] api/class.acl_mgr.php, 1.1.2.6


From: nomail
Subject: [Phpgroupware-cvs] api/class.acl_mgr.php, 1.1.2.6
Date: Thu, 20 May 2004 16:04:00 -0000

Update of /api
Modified Files:
        Branch: proposal-branch
          class.acl_mgr.php

date: 2004/04/16 20:59:48;  author: seek3r;  state: Exp;  lines: +353 -355

Log Message:
bringing savannah cvs back up to date with what we were doing on our private 
cvs server. We will not be doing dev from this cvs tree
=====================================================================
No syntax errors detected in -
=====================================================================
Index: api/class.acl_mgr.php
diff -u api/class.acl_mgr.php:1.1.2.5 api/class.acl_mgr.php:1.1.2.6
--- api/class.acl_mgr.php:1.1.2.5       Sun Feb 29 00:19:37 2004
+++ api/class.acl_mgr.php       Fri Apr 16 20:59:48 2004
@@ -1,355 +1,353 @@
-<?php
-       
/**************************************************************************\
-       * phpGroupWare                                                          
   *
-       * http://www.phpgroupware.org                                           
   *
-       * This file written by Joseph Engo <address@hidden>                *
-       * Copyright (C) 2003 Joseph Engo                                        
   *
-       * 
-------------------------------------------------------------------------*
-       * This library is part of the phpGroupWare API                          
   *
-       * http://www.phpgroupware.org/api                                       
   * 
-       * 
------------------------------------------------------------------------ *
-       * This library is free software; you can redistribute it and/or modify 
it  *
-       * under the terms of the GNU Lesser General Public License as published 
by *
-       * the Free Software Foundation; either version 2.1 of the License,      
   *
-       * or any later version.                                                 
   *
-       * This library 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 Lesser General Public License for more details.           
   *
-       * You should have received a copy of the GNU Lesser General Public 
License *
-       * along with this library; if not, write to the Free Software 
Foundation,  *
-       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
   *
-       
\**************************************************************************/
-
-       /* $Id$ */
-       /* $Source$ */
-
-       $functions             = array();
-       $functions['api_acl_mgr'] = array(
-               'type'         => 'public',
-               'abstract'     => 'ACL manager',
-               'discussion'   => 'ACL manager'
-       );
-
-       $functions['account']  = array(
-               'type'         => 'public',
-               'title'        => 'Account ACL manager',
-               'abstract'     => 'ACL manager for accounts'
-       );
-
-       $functions['record']   = array(
-               'type'         => 'public',
-               'title'        => 'Record ACL manager',
-               'abstract'     => 'ACL manager for records'
-       );
-
-       $GLOBALS['docs']['api']['classes']['api_acl_mgr'] = array(
-               'abstract'  => 'ACL management',
-               'functions' => $functions
-       );
-
-       class api_acl_mgr
-       {
-               function api_acl_mgr()
-               {
-                       $GLOBALS['phpgw']->add_xsl('api.acl_mgr');
-               }
-
-               function account()
-               {
-                       /*
-                       $result['acl_options'][] = array(
-                               'app'       => 'api',
-                               'title'     => 'Accounts manager',
-                               'locations' => array(
-                                       0 => array(
-                                               'title'    => 'Create accounts',
-                                               'location' => 
'account_mgr.create',
-                                               'value'    => 1
-                                       ),
-                                       1 => array(
-                                               'title'    => 'View accounts',
-                                               'location' => 
'account_mgr.view',
-                                               'value'    => 2
-                                       ),
-                                       2 => array(
-                                               'title'    => 'Delete accounts',
-                                               'location' => 
'account_mgr.delete',
-                                               'value'    => 4
-                                       )
-                               )
-
-                       );
-                       $result['acl_options'][] = array(
-                               'app'       => 'calendar',
-                               'title'     => 'Calendar',
-                               'locations' => array(
-                                       0 => array(
-                                               'title'    => 'Create entrys',
-                                               'location' => 'base.create',
-                                               'value'    => 1
-                                       ),
-                                       1 => array(
-                                               'title'    => 'Edit entry',
-                                               'location' => 'base.edit',
-                                               'value'    => 2
-                                       ),
-                                       2 => array(
-                                               'title'    => 'Delete entrys',
-                                               'location' => 'base.delete',
-                                               'value'    => 4
-                                       ),
-                                       3 => array(
-                                               'title'    => 'Import entrys',
-                                               'location' => 'base.import',
-                                               'value'    => 8
-                                       ),
-                                       4 => array(
-                                               'title'    => 'Export entrys',
-                                               'location' => 'base.export',
-                                               'value'    => 16
-                                       )
-                               )
-
-                       );
-                       $result['acl_options'][] = array(
-                               'app'       => 'wcm',
-                               'title'     => 'Web content manager'
-                       );
-
-                       $result['acl_options'][] = array(
-                               'app'       => 'tts',
-                               'title'     => 'Trouble Tickets',
-                               'locations' => array(
-                                       0 => array(
-                                               'title'    => 'Create ticket',
-                                               'location' => 'base.create',
-                                               'values'   => array(
-                                                       0 => array(
-                                                               'title' => 
'Assign to other user',
-                                                               'value' => 1
-                                                       ),
-                                                       1 => array(
-                                                               'title' => 
'Assign to other group',
-                                                               'value' => 2
-                                                       ),
-                                                       2 => array(
-                                                               'title' => 'Set 
priority',
-                                                               'value' => 4
-                                                       )
-                                               ),
-                                       ),
-                                       1 => array(
-                                               'title'    => 'Edit ticket',
-                                               'location' => 'base.edit',
-                                               'values'   => array(
-                                                       0 => array(
-                                                               'title' => 
'Re-assign to other user',
-                                                               'value' => 1
-                                                       ),
-                                                       1 => array(
-                                                               'title' => 
'Re-assign to other group',
-                                                               'value' => 2
-                                                       ),
-                                                       2 => array(
-                                                               'title' => 'Set 
priority',
-                                                               'value' => 4
-                                                       ),
-                                                       3 => array(
-                                                               'title' => 
'Change status',
-                                                               'value' => 8
-                                                       )
-                                               ),
-                                       ),
-                                       2 => array(
-                                               'title'    => 'View Ticket',
-                                               'location' => 'base.view',
-                                               'value'    => 1
-                                       ),
-                                       3 => array(
-                                               'title'    => 'Show closed 
tickets',
-                                               'location' => 
'base.show_closed',
-                                               'value'    => 2
-                                       )
-                               )
-                       );
-
-                       $result['acl_options'][] = array(
-                               'app'       => 'test1',
-                               'title'     => 'Test 1',
-                               'locations' => array(
-                                       0 => array(
-                                               'title'    => 'A',
-                                               'location' => 'base.A',
-                                               'value'    => 1
-                                       )
-                               )
-                       );
-                       $result['acl_options'][] = array(
-                               'app'       => 'test2',
-                               'title'     => 'Test 2',
-                               'locations' => array(
-                                       0 => array(
-                                               'title'    => 'A',
-                                               'location' => 'base.A',
-                                               'value'    => 1
-                                       ),
-                                       1 => array(
-                                               'title'    => 'B',
-                                               'location' => 'base.B',
-                                               'value'    => 2
-                                       )
-                               )
-                       );
-
-                       $result['acl_options'][] = array(
-                               'app'       => 'test3',
-                               'title'     => 'Test 3',
-                               'locations' => array(
-                                       0 => array(
-                                               'title'    => 'A',
-                                               'location' => 'base.A',
-                                               'value'    => 1
-                                       ),
-                                       1 => array(
-                                               'title'    => 'B',
-                                               'location' => 'base.B',
-                                               'value'    => 2
-                                       ),
-                                       2 => array(
-                                               'title'    => 'C',
-                                               'location' => 'base.C',
-                                               'value'    => 4
-                                       ),
-                                       3 => array(
-                                               'title'    => 'D',
-                                               'location' => 'base.D',
-                                               'value'    => 8
-                                       )
-                               )
-                       );*/
-
-                       $apps = $GLOBALS['phpgw']->apps->get_user_apps();
-
-                       $dbresult1 = $GLOBALS['phpgw']->db->execute("select * 
from phpgw_acl_locations where loc_op not like '%.%.%'",__LINE__,__FILE__);
-                       while (! $dbresult1->EOF && $dbresult1->movenext())
-                       {
-                               $locations = array();
-
-                               $dbresult2 = 
$GLOBALS['phpgw']->db->execute("select count(loc_op),loc_op from 
phpgw_acl_locations where loc_op like '" . $this->db->f('loc_op') . ".%' group 
by loc_op",__LINE__,__FILE__);
-                               while ($dbresult2->EOF && 
$dbresult2->movenext())
-                               {
-                                       if ($dbresult2->fields[0] == 1)
-                                       {
-                                               $dbresult3 = 
$GLOBALS['phpgw']->db->execute("select * from phpgw_acl_locations where 
loc_op='" . $db2->f('loc_op') . "'",__LINE__,__FILE__);
-                                               while ($dbresult3->EOF && 
$dbresult3->movenext())
-                                               {
-                                                       $locations[] = array(
-                                                               'title'    => 
$dbresult3->fields['loc_title'],
-                                                               'location' => 
$dbresult3->fields['loc_op'],
-                                                               'value'    => 
$dbresult3->fields['loc_value']
-                                                       );
-                                               }
-                                       }
-                                       else
-                                       {
-                                               $values = array();
-                                               $dbresult3 = 
$GLOBALS['phpgw']->db->execute("select * from phpgw_acl_locations where 
loc_op='" . $db2->f('loc_op') . "'",__LINE__,__FILE__);
-                                               $first_row = True;
-
-                                               while ($dbresult3->EOF && 
$dbresult3->movenext())
-                                               {
-                                                       if ($first_row)
-                                                       {
-                                                               $first_row = 
False;
-                                                               $title = 
$dbresult3->fields['loc_title'];
-                                                       }
-
-                                                       $values[] = array(
-                                                               'title'  => 
$dbresult3->fields['loc_title'],
-                                                               'value'  => 
$dbresult3->fields['loc_value']
-                                                       );
-                                               }
-
-                                               $locations[] = array(
-                                                       'title'    => $title,
-                                                       'location' => 
$db2->f('loc_op'),
-                                                       'values'   => $values
-                                               );
-                                       }
-                               }
-
-                               list($app,$class,$method) = 
explode(".",$dbresult1->fields['loc_op']);
-                               if (count($locations))
-                               {
-                                       $result['acl_options'][] = array(
-                                               'app'       => $app,
-                                               'title'     => 
$dbresults1->fields['loc_title'],
-                                               'locations' => $locations
-                                       );
-                               }
-                               else
-                               {
-                                       $result['acl_options'][] = array(
-                                               'app'       => $app,
-                                               'title'     => 
$dbresult1->fields['loc_title']
-                                       );
-                               }
-                       }
-
-                       $result['action'] = 'acl_mgr_account_advanced';
-                       return $result;
-               }
-
-               // The acl_check parameter is an override for being able to 
view a users acl
-               // Maybe that part should be its own function. (jengo)
-               function basic()
-               {
-                       $args = new safe_args();
-                       $args->set('account_id','##NOTSET##','any');
-                       $args->set('acl_check',True,'any');
-                       $args = $args->get(func_get_args(),__LINE__,__FILE__);
-
-                       $dbresult = $GLOBALS['phpgw']->db->execute("select * 
from phpgw_acl_locations where loc_op not like '%.%.%' order by 
loc_title",__LINE__,__FILE__);
-                       while ($dbresult->EOF && $dbresult->movenext())
-                       {
-                               $has_access = False;
-                               if (! $args['account_id'])
-                               {
-                                       if 
($GLOBALS['phpgw']->acl->check($dbresult->fields['loc_op'],$dbresult->fields['loc_value'],1))
-                                       {
-                                               $has_access = True;
-                                       }
-                               }
-                               else
-                               {
-                                       if 
($GLOBALS['phpgw']->acl->check_specific($dbresult->fields['loc_op'],$dbresult->fields['loc_value'],$args['account_id'],1))
-                                       {
-                                               $has_access = True;
-                                       }
-                               }
-
-                               if (! $args['acl_check'])
-                               {
-                                       $has_access = True;
-                               }
-
-                               if ($has_access)
-                               {
-                                       $result[] = array(
-                                               'op'    => 
$dbresult->fields['loc_op'],
-                                               'title' => 
lang($dbresult->fields['loc_title'])
-                                       );
-                               }
-                       }
-
-                       return $result;
-               }
-
-               function record()
-               {
-
-               }
-       }
-
-
+<?php
+       
/**************************************************************************\
+       * phpGroupWare                                                          
   *
+       * http://www.phpgroupware.org                                           
   *
+       * This file written by Joseph Engo <address@hidden>                *
+       * Copyright (C) 2003 Joseph Engo                                        
   *
+       * 
-------------------------------------------------------------------------*
+       * This library is part of the phpGroupWare API                          
   *
+       * http://www.phpgroupware.org/api                                       
   * 
+       * 
------------------------------------------------------------------------ *
+       * This library is free software; you can redistribute it and/or modify 
it  *
+       * under the terms of the GNU Lesser General Public License as published 
by *
+       * the Free Software Foundation; either version 2.1 of the License,      
   *
+       * or any later version.                                                 
   *
+       * This library 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 Lesser General Public License for more details.           
   *
+       * You should have received a copy of the GNU Lesser General Public 
License *
+       * along with this library; if not, write to the Free Software 
Foundation,  *
+       * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA         
   *
+       
\**************************************************************************/
+
+       /* $Id$ */
+       /* $Source$ */
+
+       $functions             = array();
+       $functions['api_acl_mgr'] = array(
+               'type'         => 'public',
+               'abstract'     => 'ACL manager',
+               'discussion'   => 'ACL manager'
+       );
+
+       $functions['account']  = array(
+               'type'         => 'public',
+               'title'        => 'Account ACL manager',
+               'abstract'     => 'ACL manager for accounts'
+       );
+
+       $functions['record']   = array(
+               'type'         => 'public',
+               'title'        => 'Record ACL manager',
+               'abstract'     => 'ACL manager for records'
+       );
+
+       $GLOBALS['docs']['api']['classes']['api_acl_mgr'] = array(
+               'abstract'  => 'ACL management',
+               'functions' => $functions
+       );
+
+       class api_acl_mgr
+       {
+               function api_acl_mgr()
+               {
+                       $GLOBALS['phpgw']->add_xsl('api.acl_mgr');
+               }
+
+               function account()
+               {
+                       /*
+                       $result['acl_options'][] = array(
+                               'app'       => 'api',
+                               'title'     => 'Accounts manager',
+                               'locations' => array(
+                                       0 => array(
+                                               'title'    => 'Create accounts',
+                                               'location' => 
'account_mgr.create',
+                                               'value'    => 1
+                                       ),
+                                       1 => array(
+                                               'title'    => 'View accounts',
+                                               'location' => 
'account_mgr.view',
+                                               'value'    => 2
+                                       ),
+                                       2 => array(
+                                               'title'    => 'Delete accounts',
+                                               'location' => 
'account_mgr.delete',
+                                               'value'    => 4
+                                       )
+                               )
+
+                       );
+                       $result['acl_options'][] = array(
+                               'app'       => 'calendar',
+                               'title'     => 'Calendar',
+                               'locations' => array(
+                                       0 => array(
+                                               'title'    => 'Create entrys',
+                                               'location' => 'base.create',
+                                               'value'    => 1
+                                       ),
+                                       1 => array(
+                                               'title'    => 'Edit entry',
+                                               'location' => 'base.edit',
+                                               'value'    => 2
+                                       ),
+                                       2 => array(
+                                               'title'    => 'Delete entrys',
+                                               'location' => 'base.delete',
+                                               'value'    => 4
+                                       ),
+                                       3 => array(
+                                               'title'    => 'Import entrys',
+                                               'location' => 'base.import',
+                                               'value'    => 8
+                                       ),
+                                       4 => array(
+                                               'title'    => 'Export entrys',
+                                               'location' => 'base.export',
+                                               'value'    => 16
+                                       )
+                               )
+
+                       );
+                       $result['acl_options'][] = array(
+                               'app'       => 'wcm',
+                               'title'     => 'Web content manager'
+                       );
+
+                       $result['acl_options'][] = array(
+                               'app'       => 'tts',
+                               'title'     => 'Trouble Tickets',
+                               'locations' => array(
+                                       0 => array(
+                                               'title'    => 'Create ticket',
+                                               'location' => 'base.create',
+                                               'values'   => array(
+                                                       0 => array(
+                                                               'title' => 
'Assign to other user',
+                                                               'value' => 1
+                                                       ),
+                                                       1 => array(
+                                                               'title' => 
'Assign to other group',
+                                                               'value' => 2
+                                                       ),
+                                                       2 => array(
+                                                               'title' => 'Set 
priority',
+                                                               'value' => 4
+                                                       )
+                                               ),
+                                       ),
+                                       1 => array(
+                                               'title'    => 'Edit ticket',
+                                               'location' => 'base.edit',
+                                               'values'   => array(
+                                                       0 => array(
+                                                               'title' => 
'Re-assign to other user',
+                                                               'value' => 1
+                                                       ),
+                                                       1 => array(
+                                                               'title' => 
'Re-assign to other group',
+                                                               'value' => 2
+                                                       ),
+                                                       2 => array(
+                                                               'title' => 'Set 
priority',
+                                                               'value' => 4
+                                                       ),
+                                                       3 => array(
+                                                               'title' => 
'Change status',
+                                                               'value' => 8
+                                                       )
+                                               ),
+                                       ),
+                                       2 => array(
+                                               'title'    => 'View Ticket',
+                                               'location' => 'base.view',
+                                               'value'    => 1
+                                       ),
+                                       3 => array(
+                                               'title'    => 'Show closed 
tickets',
+                                               'location' => 
'base.show_closed',
+                                               'value'    => 2
+                                       )
+                               )
+                       );
+
+                       $result['acl_options'][] = array(
+                               'app'       => 'test1',
+                               'title'     => 'Test 1',
+                               'locations' => array(
+                                       0 => array(
+                                               'title'    => 'A',
+                                               'location' => 'base.A',
+                                               'value'    => 1
+                                       )
+                               )
+                       );
+                       $result['acl_options'][] = array(
+                               'app'       => 'test2',
+                               'title'     => 'Test 2',
+                               'locations' => array(
+                                       0 => array(
+                                               'title'    => 'A',
+                                               'location' => 'base.A',
+                                               'value'    => 1
+                                       ),
+                                       1 => array(
+                                               'title'    => 'B',
+                                               'location' => 'base.B',
+                                               'value'    => 2
+                                       )
+                               )
+                       );
+
+                       $result['acl_options'][] = array(
+                               'app'       => 'test3',
+                               'title'     => 'Test 3',
+                               'locations' => array(
+                                       0 => array(
+                                               'title'    => 'A',
+                                               'location' => 'base.A',
+                                               'value'    => 1
+                                       ),
+                                       1 => array(
+                                               'title'    => 'B',
+                                               'location' => 'base.B',
+                                               'value'    => 2
+                                       ),
+                                       2 => array(
+                                               'title'    => 'C',
+                                               'location' => 'base.C',
+                                               'value'    => 4
+                                       ),
+                                       3 => array(
+                                               'title'    => 'D',
+                                               'location' => 'base.D',
+                                               'value'    => 8
+                                       )
+                               )
+                       );*/
+
+                       $apps = $GLOBALS['phpgw']->apps->get_user_apps();
+
+                       $dbresult1 = $GLOBALS['phpgw']->db->Execute("select * 
from phpgw_acl_locations where loc_op not like '%.%.%'");
+                       while (! $dbresult1->EOF && $dbresult1->movenext())
+                       {
+                               $locations = array();
+
+                               $dbresult2 = 
$GLOBALS['phpgw']->db->Execute("select count(loc_op),loc_op from 
phpgw_acl_locations where loc_op like '" . $this->db->f('loc_op') . ".%' group 
by loc_op");
+                               while ($dbresult2->EOF && 
$dbresult2->movenext())
+                               {
+                                       if ($dbresult2->fields[0] == 1)
+                                       {
+                                               $dbresult3 = 
$GLOBALS['phpgw']->db->Execute("select * from phpgw_acl_locations where 
loc_op='" . $db2->f('loc_op') . "'");
+                                               while ($dbresult3->EOF && 
$dbresult3->movenext())
+                                               {
+                                                       $locations[] = array(
+                                                               'title'    => 
$dbresult3->fields['loc_title'],
+                                                               'location' => 
$dbresult3->fields['loc_op'],
+                                                               'value'    => 
$dbresult3->fields['loc_value']
+                                                       );
+                                               }
+                                       }
+                                       else
+                                       {
+                                               $values = array();
+                                               $dbresult3 = 
$GLOBALS['phpgw']->db->Execute("select * from phpgw_acl_locations where 
loc_op='" . $db2->f('loc_op') . "'");
+                                               $first_row = true;
+
+                                               while ($dbresult3->EOF && 
$dbresult3->movenext())
+                                               {
+                                                       if ($first_row)
+                                                       {
+                                                               $first_row = 
false;
+                                                               $title = 
$dbresult3->fields['loc_title'];
+                                                       }
+
+                                                       $values[] = array(
+                                                               'title'  => 
$dbresult3->fields['loc_title'],
+                                                               'value'  => 
$dbresult3->fields['loc_value']
+                                                       );
+                                               }
+
+                                               $locations[] = array(
+                                                       'title'    => $title,
+                                                       'location' => 
$db2->f('loc_op'),
+                                                       'values'   => $values
+                                               );
+                                       }
+                               }
+
+                               list($app,$class,$method) = 
explode(".",$dbresult1->fields['loc_op']);
+                               if (count($locations))
+                               {
+                                       $result['acl_options'][] = array(
+                                               'app'       => $app,
+                                               'title'     => 
$dbresults1->fields['loc_title'],
+                                               'locations' => $locations
+                                       );
+                               }
+                               else
+                               {
+                                       $result['acl_options'][] = array(
+                                               'app'       => $app,
+                                               'title'     => 
$dbresult1->fields['loc_title']
+                                       );
+                               }
+                       }
+
+                       $result['action'] = 'acl_mgr_account_advanced';
+                       return $result;
+               }
+
+               // The acl_check parameter is an override for being able to 
view a users acl
+               // Maybe that part should be its own function. (jengo)
+               function basic()
+               {
+                       $args = new safe_args();
+                       $args->set('account_id',NOTSET,'any');
+                       $args->set('acl_check',true,'any');
+                       $args = $args->get(func_get_args());
+
+                       $dbresult = $GLOBALS['phpgw']->db->Execute("select * 
from phpgw_acl_locations where loc_op not like '%.%.%' order by loc_title");
+                       while ($dbresult->EOF && $dbresult->movenext())
+                       {
+                               $has_access = false;
+                               if (! $args['account_id'])
+                               {
+                                       if 
($GLOBALS['phpgw']->acl->check($dbresult->fields['loc_op'],$dbresult->fields['loc_value'],1))
+                                       {
+                                               $has_access = true;
+                                       }
+                               }
+                               else
+                               {
+                                       if 
($GLOBALS['phpgw']->acl->check_specific($dbresult->fields['loc_op'],$dbresult->fields['loc_value'],$args['account_id'],1))
+                                       {
+                                               $has_access = true;
+                                       }
+                               }
+
+                               if (! $args['acl_check'])
+                               {
+                                       $has_access = true;
+                               }
+
+                               if ($has_access)
+                               {
+                                       $result[] = array(
+                                               'op'    => 
$dbresult->fields['loc_op'],
+                                               'title' => 
lang($dbresult->fields['loc_title'])
+                                       );
+                               }
+                       }
+
+                       return $result;
+               }
+
+               function record()
+               {
+
+               }
+       }




reply via email to

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