[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] preferences/inc class.boadmin_acl.inc.php class...
From: |
Dave Hall |
Subject: |
[Phpgroupware-cvs] preferences/inc class.boadmin_acl.inc.php class... |
Date: |
Wed, 04 Oct 2006 05:23:56 +0000 |
CVSROOT: /cvsroot/phpgroupware
Module name: preferences
Changes by: Dave Hall <skwashd> 06/10/04 05:23:56
Modified files:
inc : class.boadmin_acl.inc.php
class.uiadmin_acl.inc.php
Log message:
notices and formatting
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/preferences/inc/class.boadmin_acl.inc.php?cvsroot=phpgroupware&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/preferences/inc/class.uiadmin_acl.inc.php?cvsroot=phpgroupware&r1=1.3&r2=1.4
Patches:
Index: class.boadmin_acl.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/preferences/inc/class.boadmin_acl.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- class.boadmin_acl.inc.php 25 Jul 2006 01:13:38 -0000 1.3
+++ class.boadmin_acl.inc.php 4 Oct 2006 05:23:56 -0000 1.4
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package hrm
* @subpackage admin
- * @version $Id: class.boadmin_acl.inc.php,v 1.3 2006/07/25 01:13:38
skwashd Exp $
+ * @version $Id: class.boadmin_acl.inc.php,v 1.4 2006/10/04 05:23:56
skwashd Exp $
*/
/**
@@ -26,6 +26,11 @@
var $cat_id;
var $acl_app;
+ /**
+ * @var int $total_records the total number of records found
during last search
+ */
+ var $total_records = 0;
+
function boadmin_acl($session='')
{
$this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
@@ -216,28 +221,39 @@
}
- function set_permission2($values,$r_processed, $grantor =
False, $type = False)
+ function set_permission2($values,$r_processed, $grantor = 0,
$type = 0)
{
- @reset($values);
+ if ( !is_array($values) )
+ {
+ return;
+ }
+
$totalacl = array();
- while(list($rowinfo,$perm) = each($values))
+ foreach ( $values as $rowinfo => $perm )
{
- list($user_id,$rights) = split('_',$rowinfo);
+ list($user_id,$rights) = split('_', $rowinfo);
+
+ if ( !isset($totalacl[$user_id]) )
+ {
+ $totalacl[$user_id] = 0;
+ }
+
$totalacl[$user_id] += $rights;
}
- @reset($totalacl);
- while(list($user_id,$rights) = @each($totalacl))
+
+ $user_checked = array();
+ foreach ( $totalacl as $user_id => $rights )
{
- $user_checked[]=$user_id;
+ $user_checked[] = $user_id;
- $this->acl->account_id=$user_id;
+ $this->acl->account_id = $user_id;
$this->acl->read_repository();
- $this->acl->delete($appname = $this->acl_app,
$this->location,$grantor,$type);
- $this->acl->add($appname = $this->acl_app,
$this->location, $rights,$grantor,$type);
+ $this->acl->delete($this->acl_app,
$this->location, $grantor, $type);
+ $this->acl->add($this->acl_app,
$this->location, $rights, $grantor, $type);
$this->acl->save_repository();
}
- if(is_array($r_processed) && is_array($user_checked))
+ if (is_array($r_processed) && count($user_checked))
{
$user_delete = array_diff($r_processed,
$user_checked);
}
@@ -249,28 +265,30 @@
{
while(list(,$user_id) = each($user_delete))
{
- $this->acl->account_id=$user_id;
+ $this->acl->account_id = $user_id;
$this->acl->read_repository();
- $this->acl->delete($appname =
$this->acl_app, $this->location,$grantor,$type);
+ $this->acl->delete($this->acl_app,
$this->location, $grantor, $type);
$this->acl->save_repository();
}
}
}
- function set_permission($values,$r_processed,$set_grant = '')
+ function set_permission($values,$r_processed,$set_grant = false)
{
- $r_processed=explode("_",$r_processed);
+ $process = explode('_', $r_processed);
- if(!$values['right'])
+ if ( !isset($values['right']) ||
!is_array($values['right']) )
{
$values['right'] = array();
}
- if(!$values['mask'])
+
+ if ( !isset($values['mask']) ||
!is_array($values['mask']) )
{
$values['mask'] = array();
}
+ $grantor = 0;
if($set_grant)
{
if($this->granting_group)
@@ -283,8 +301,8 @@
}
}
-
$this->set_permission2($values['right'],$r_processed,$grantor,0);
-
$this->set_permission2($values['mask'],$r_processed,$grantor,1);
+ $this->set_permission2($values['right'], $process,
$grantor, 0);
+ $this->set_permission2($values['mask'], $process,
$grantor, 1);
$receipt['message'][] = array('msg' =>
lang('permissions are updated!'));
return $receipt;
@@ -302,6 +320,7 @@
$check_account_type =
array('groups','accounts');
}
+ $grantor = 0;
if($get_grants)
{
if($this->granting_group)
@@ -316,6 +335,7 @@
$right=$this->right;
+ $offset =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
if ($this->allrows)
{
$this->start = -1;
@@ -324,7 +344,7 @@
$allusers =
$GLOBALS['phpgw']->accounts->get_list($type, $this->start,$this->sort,
$this->order, $this->query, $offset);
- if (isSet($allusers) AND is_array($allusers))
+ if ( isset($allusers) && is_array($allusers))
{
$j=0;
foreach($allusers as $account)
@@ -339,7 +359,7 @@
$this->acl->read_repository();
$count_right=count($right);
- for ($i=0;$i<$count_right;$i++)
+ for ( $i = 0; $i < $count_right; ++$i )
{
if($this->acl->check_brutto($this->location,
$right[$i],$this->acl_app,$grantor,0,$check_account_type))
{
Index: class.uiadmin_acl.inc.php
===================================================================
RCS file: /cvsroot/phpgroupware/preferences/inc/class.uiadmin_acl.inc.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- class.uiadmin_acl.inc.php 14 Jun 2006 11:01:09 -0000 1.3
+++ class.uiadmin_acl.inc.php 4 Oct 2006 05:23:56 -0000 1.4
@@ -8,7 +8,7 @@
* @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
* @package hrm
* @subpackage admin
- * @version $Id: class.uiadmin_acl.inc.php,v 1.3 2006/06/14 11:01:09
sigurdne Exp $
+ * @version $Id: class.uiadmin_acl.inc.php,v 1.4 2006/10/04 05:23:56
skwashd Exp $
*/
/**
@@ -44,8 +44,8 @@
$this->nextmatchs =
CreateObject('phpgwapi.nextmatchs');
$this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
- $this->bo =
CreateObject($this->currentapp . '.boadmin_acl',true);
- $this->bocommon =
CreateObject($this->currentapp . '.bocommon');
+ $this->bo =
CreateObject('preferences.boadmin_acl',true);
+ $this->bocommon =
CreateObject('preferences.bocommon');
$this->acl_app =
$this->bo->acl_app;
$this->start =
$this->bo->start;
@@ -96,7 +96,7 @@
if ($this->location)
{
- if($this->cat_id=='accounts')
+ if ( $this->cat_id == 'accounts' )
{
$user_list =
$this->bo->get_user_list('accounts',true);
}
@@ -109,18 +109,18 @@
'account_id'
=> $user['account_id'],
'lid'
=> $user['account_lid'],
'name'
=> $user['account_firstname'] . ' ' . $user['account_lastname'],
- 'read_right'
=> $user['right'][1],
- 'add_right'
=> $user['right'][2],
- 'edit_right'
=> $user['right'][4],
- 'delete_right'
=> $user['right'][8],
- 'read_mask'
=> $user['mask'][1],
- 'add_mask'
=> $user['mask'][2],
- 'edit_mask'
=> $user['mask'][4],
- 'delete_mask'
=> $user['mask'][8],
- 'read_result'
=> $user['result'][1],
- 'add_result'
=> $user['result'][2],
- 'edit_result'
=> $user['result'][4],
- 'delete_result'
=> $user['result'][8],
+ 'read_right' =>
isset($user['right'][PHPGW_ACL_READ]) ? !!$user['right'][PHPGW_ACL_READ] :
false,
+ 'add_right' =>
isset($user['right'][PHPGW_ACL_ADD]) ? !!$user['right'][PHPGW_ACL_ADD] : false,
+ 'edit_right' =>
isset($user['right'][PHPGW_ACL_EDIT]) ? !!$user['right'][PHPGW_ACL_EDIT] :
false,
+ 'delete_right' =>
isset($user['right'][PHPGW_ACL_DELETE]) ? !!$user['right'][PHPGW_ACL_DELETE] :
false,
+ 'read_mask' =>
isset($user['mask'][PHPGW_ACL_READ]) ? !!$user['mask'][PHPGW_ACL_READ] : false,
+ 'add_mask' =>
isset($user['mask'][PHPGW_ACL_ADD]) ? !!$user['mask'][PHPGW_ACL_ADD] : false,
+ 'edit_mask' =>
isset($user['mask'][PHPGW_ACL_EDIT]) ? !!$user['mask'][PHPGW_ACL_EDIT] : false,
+ 'delete_mask' =>
isset($user['mask'][PHPGW_ACL_DELETE]) ? !!$user['mask'][PHPGW_ACL_DELETE] :
false,
+ 'read_result' =>
isset($user['result'][PHPGW_ACL_READ]) ? !!$user['result'][PHPGW_ACL_READ] :
false,
+ 'add_result' =>
isset($user['result'][PHPGW_ACL_ADD]) ? !!$user['result'][PHPGW_ACL_ADD] :
false,
+ 'edit_result' =>
isset($user['resilt'][PHPGW_ACL_EDIT]) ? !!$user['result'][PHPGW_ACL_EDIT] :
false,
+ 'delete_result' =>
isset($user['result'][PHPGW_ACL_DELETE]) ? !!$user['result'][PHPGW_ACL_DELETE]
: false,
'lang_right'
=> lang('right'),
'lang_mask'
=> lang('mask'),
'lang_result'
=> lang('result'),
@@ -146,18 +146,18 @@
'account_id'
=> $group['account_id'],
'lid'
=> $group['account_lid'],
'name'
=> $group['account_firstname'],
- 'read_right'
=> $group['right'][1],
- 'add_right'
=> $group['right'][2],
- 'edit_right'
=> $group['right'][4],
- 'delete_right'
=> $group['right'][8],
- 'read_mask'
=> $group['mask'][1],
- 'add_mask'
=> $group['mask'][2],
- 'edit_mask'
=> $group['mask'][4],
- 'delete_mask'
=> $group['mask'][8],
- 'read_result'
=> $group['result'][1],
- 'add_result'
=> $group['result'][2],
- 'edit_result'
=> $group['result'][4],
- 'delete_result'
=> $group['result'][8],
+ 'read_right' =>
isset($group['right'][PHPGW_ACL_READ]) ? !!$group['right'][PHPGW_ACL_READ] :
false,
+ 'add_right' =>
isset($group['right'][PHPGW_ACL_ADD]) ? !!$group['right'][PHPGW_ACL_ADD] :
false,
+ 'edit_right' =>
isset($group['right'][PHPGW_ACL_EDIT]) ? !!$group['right'][PHPGW_ACL_EDIT] :
false,
+ 'delete_right' =>
isset($group['right'][PHPGW_ACL_DELETE]) ? !!$group['right'][PHPGW_ACL_DELETE]
: false,
+ 'read_mask' =>
isset($group['mask'][PHPGW_ACL_READ]) ? !!$group['mask'][PHPGW_ACL_READ] :
false,
+ 'add_mask' =>
isset($group['mask'][PHPGW_ACL_ADD]) ? !!$group['mask'][PHPGW_ACL_ADD] : false,
+ 'edit_mask' =>
isset($group['mask'][PHPGW_ACL_EDIT]) ? !!$group['mask'][PHPGW_ACL_EDIT] :
false,
+ 'delete_mask' =>
isset($group['mask'][PHPGW_ACL_DELETE]) ? !!$group['mask'][PHPGW_ACL_DELETE] :
false,
+ 'read_result' =>
isset($group['result'][PHPGW_ACL_READ]) ? !!$group['result'][PHPGW_ACL_READ] :
false,
+ 'add_result' =>
isset($group['result'][PHPGW_ACL_ADD]) ? !!$group['result'][PHPGW_ACL_ADD] :
false,
+ 'edit_result' =>
isset($group['resilt'][PHPGW_ACL_EDIT]) ? !!$group['result'][PHPGW_ACL_EDIT] :
false,
+ 'delete_result' =>
isset($group['result'][PHPGW_ACL_DELETE]) ?
!!$group['result'][PHPGW_ACL_DELETE] : false,
'lang_right'
=> lang('right'),
'lang_mask'
=> lang('mask'),
'lang_result'
=> lang('result'),
@@ -187,13 +187,13 @@
$link_data = array
(
'menuaction' => $this->currentapp .
'.uiadmin_acl.aclprefs',
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'cat_id' => $this->cat_id,
+ 'filter' => $this->filter,
+ 'query' => $this->query,
'module' =>
$this->location,
- 'granting_group' =>
$this->granting_group,
+ 'granting_group'=> $this->granting_group,
'acl_app' =>
$this->acl_app
);
@@ -265,9 +265,7 @@
function list_acl()
{
-
-
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_acl','nextmatchs',
-
'search_field'));
+
$GLOBALS['phpgw']->xslttpl->add_file(array('admin_acl','nextmatchs','search_field'));
$values =
get_var('values',array('POST'));
$r_processed = get_var('processed',array('POST'));
@@ -276,17 +274,22 @@
if($set_permission)
{
- $receipt =
$this->bo->set_permission($values,$r_processed);
+ $receipt = $this->bo->set_permission($values,
$r_processed);
}
- if ($this->location)
+ $processed = array();
+ $user_list = array();
+ $group_list = array();
+ $users = array();
+ $groups = array();
+ if ( $this->location )
{
- if($this->cat_id=='accounts')
+ if ( $this->cat_id == 'accounts' )
{
$user_list =
$this->bo->get_user_list('accounts');
}
- if (isSet($user_list) AND is_array($user_list))
+ if ( isset($user_list) && is_array($user_list) )
{
foreach($user_list as $user)
{
@@ -296,21 +299,21 @@
'account_id'
=> $user['account_id'],
'lid'
=> $user['account_lid'],
'name'
=> $user['account_firstname'] . ' ' . $user['account_lastname'] . ' [' .
$user['account_lid'] . ']',
- 'read_right'
=> $user['right'][1],
- 'add_right'
=> $user['right'][2],
- 'edit_right'
=> $user['right'][4],
- 'delete_right'
=> $user['right'][8],
- 'manage_right'
=> $user['right'][16],
- 'read_mask'
=> $user['mask'][1],
- 'add_mask'
=> $user['mask'][2],
- 'edit_mask'
=> $user['mask'][4],
- 'delete_mask'
=> $user['mask'][8],
- 'manage_mask'
=> $user['mask'][16],
- 'read_result'
=> $user['result'][1],
- 'add_result'
=> $user['result'][2],
- 'edit_result'
=> $user['result'][4],
- 'delete_result'
=> $user['result'][8],
- 'manage_result'
=> $user['result'][16],
+ 'read_right' =>
isset($user['right'][PHPGW_ACL_READ]) ? !!$user['right'][PHPGW_ACL_READ] :
false,
+ 'add_right'
=> isset($user['right'][PHPGW_ACL_ADD]) ? !!$user['right'][PHPGW_ACL_ADD] :
false,
+ 'edit_right' =>
isset($user['right'][PHPGW_ACL_EDIT]) ? !!$user['right'][PHPGW_ACL_EDIT] :
false,
+ 'delete_right' =>
isset($user['right'][PHPGW_ACL_DELETE]) ? !!$user['right'][PHPGW_ACL_DELETE] :
false,
+ 'manage_right' =>
isset($user['right'][PHPGW_ACL_PRIVATE]) ? !!$user['right'][PHPGW_ACL_PRIVATE]
: false, //should be PHPGW_ACL_GROUP_MANAGERS
+ 'read_mask'
=> isset($user['mask'][PHPGW_ACL_READ]) ? !!$user['mask'][PHPGW_ACL_READ] :
false,
+ 'add_mask'
=> isset($user['mask'][PHPGW_ACL_ADD]) ? !!$user['mask'][PHPGW_ACL_ADD] : false,
+ 'edit_mask'
=> isset($user['mask'][PHPGW_ACL_EDIT]) ? !!$user['mask'][PHPGW_ACL_EDIT] :
false,
+ 'delete_mask' =>
isset($user['mask'][PHPGW_ACL_DELETE]) ? !!$user['mask'][PHPGW_ACL_DELETE] :
false,
+ 'manage_mask' =>
isset($user['mask'][PHPGW_ACL_PRIVATE]) ? !!$user['mask'][PHPGW_ACL_PRIVATE] :
false, //should be PHPGW_ACL_GROUP_MANAGERS
+ 'read_result' =>
isset($user['result'][PHPGW_ACL_READ]) ? !!$user['result'][PHPGW_ACL_READ] :
false,
+ 'add_result' =>
isset($user['result'][PHPGW_ACL_ADD]) ? !!$user['result'][PHPGW_ACL_ADD] :
false,
+ 'edit_result' =>
isset($user['resilt'][PHPGW_ACL_EDIT]) ? !!$user['result'][PHPGW_ACL_EDIT] :
false,
+ 'delete_result' =>
isset($user['result'][PHPGW_ACL_DELETE]) ? !!$user['result'][PHPGW_ACL_DELETE]
: false,
+ 'manage_result' =>
isset($user['result'][PHPGW_ACL_PRIVATE]) ?
!!$user['result'][PHPGW_ACL_PRIVATE] : false, //should be
PHPGW_ACL_GROUP_MANAGERS
'lang_right'
=> lang('right'),
'lang_mask'
=> lang('mask'),
'lang_result'
=> lang('result'),
@@ -324,12 +327,12 @@
}
}
- if($this->cat_id=='groups')
+ if ( $this->cat_id == 'groups')
{
$group_list =
$this->bo->get_user_list('groups');
}
- if (isSet($group_list) AND
is_array($group_list))
+ if ( isset($group_list) &&
is_array($group_list))
{
foreach($group_list as $group)
{
@@ -339,21 +342,21 @@
'account_id'
=> $group['account_id'],
'lid'
=> $group['account_lid'],
'name'
=> $group['account_firstname'],
- 'read_right'
=> $group['right'][1],
- 'add_right'
=> $group['right'][2],
- 'edit_right'
=> $group['right'][4],
- 'delete_right'
=> $group['right'][8],
- 'manage_right'
=> $group['right'][16],
- 'read_mask'
=> $group['mask'][1],
- 'add_mask'
=> $group['mask'][2],
- 'edit_mask'
=> $group['mask'][4],
- 'delete_mask'
=> $group['mask'][8],
- 'manage_mask'
=> $group['mask'][16],
- 'read_result'
=> $group['result'][1],
- 'add_result'
=> $group['result'][2],
- 'edit_result'
=> $group['result'][4],
- 'delete_result'
=> $group['result'][8],
- 'manage_result'
=> $group['result'][16],
+ 'read_right' =>
isset($group['right'][PHPGW_ACL_READ]) ? !!$group['right'][PHPGW_ACL_READ] :
false,
+ 'add_right'
=> isset($group['right'][PHPGW_ACL_ADD]) ? !!$group['right'][PHPGW_ACL_ADD] :
false,
+ 'edit_right' =>
isset($group['right'][PHPGW_ACL_EDIT]) ? !!$group['right'][PHPGW_ACL_EDIT] :
false,
+ 'delete_right' =>
isset($group['right'][PHPGW_ACL_DELETE]) ? !!$group['right'][PHPGW_ACL_DELETE]
: false,
+ 'manage_right' =>
isset($group['right'][PHPGW_ACL_PRIVATE]) ?
!!$group['right'][PHPGW_ACL_PRIVATE] : false, //should be
PHPGW_ACL_GROUP_MANAGERS
+ 'read_mask'
=> isset($group['mask'][PHPGW_ACL_READ]) ? !!$group['mask'][PHPGW_ACL_READ] :
false,
+ 'add_mask'
=> isset($group['mask'][PHPGW_ACL_ADD]) ? !!$group['mask'][PHPGW_ACL_ADD] :
false,
+ 'edit_mask'
=> isset($group['mask'][PHPGW_ACL_EDIT]) ? !!$group['mask'][PHPGW_ACL_EDIT] :
false,
+ 'delete_mask' =>
isset($group['mask'][PHPGW_ACL_DELETE]) ? !!$group['mask'][PHPGW_ACL_DELETE] :
false,
+ 'manage_mask' =>
isset($group['mask'][PHPGW_ACL_PRIVATE]) ? !!$group['mask'][PHPGW_ACL_PRIVATE]
: false, //should be PHPGW_ACL_GROUP_MANAGERS
+ 'read_result' =>
isset($group['result'][PHPGW_ACL_READ]) ? !!$group['result'][PHPGW_ACL_READ] :
false,
+ 'add_result' =>
isset($group['result'][PHPGW_ACL_ADD]) ? !!$group['result'][PHPGW_ACL_ADD] :
false,
+ 'edit_result' =>
isset($group['resilt'][PHPGW_ACL_EDIT]) ? !!$group['result'][PHPGW_ACL_EDIT] :
false,
+ 'delete_result' =>
isset($group['result'][PHPGW_ACL_DELETE]) ?
!!$group['result'][PHPGW_ACL_DELETE] : false,
+ 'manage_result' =>
isset($group['result'][PHPGW_ACL_PRIVATE]) ?
!!$group['result'][PHPGW_ACL_PRIVATE] : false, //should be
PHPGW_ACL_GROUP_MANAGERS
'lang_right'
=> lang('right'),
'lang_mask'
=> lang('mask'),
'lang_result'
=> lang('result'),
@@ -366,9 +369,7 @@
);
}
}
-
-
- address@hidden("_", $processed);
+ $processed = implode('_', $processed);
}
@@ -422,17 +423,18 @@
$link_data = array
(
- 'menuaction' => $this->currentapp .
'.uiadmin_acl.list_acl',
+ 'menuaction' =>
'preferences.uiadmin_acl.list_acl',
'acl_app' =>
$this->acl_app,
- 'sort'
=>$this->sort,
- 'order'
=>$this->order,
- 'cat_id'
=>$this->cat_id,
- 'filter'
=>$this->filter,
- 'query'
=>$this->query,
+ 'sort' => $this->sort,
+ 'order' => $this->order,
+ 'cat_id' => $this->cat_id,
+ 'filter' => $this->filter,
+ 'query' => $this->query,
'module' =>
$this->location
);
+ $receipt = array();
if(!$this->location)
{
$receipt['error'][] = array('msg' =>
lang('select a location!'));
@@ -465,7 +467,7 @@
'lang_done'
=> lang('done'),
'processed'
=> $processed,
'location'
=> $this->location,
- 'links'
=> $links,
+ //'links'
=> $links, //never initialised
'num_records'
=> $num_records,
'all_records'
=> $this->bo->total_records,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] preferences/inc class.boadmin_acl.inc.php class...,
Dave Hall <=