fixed handling of group acl: addressbook eg. is NOT using it at all

This commit is contained in:
Ralf Becker 2010-04-20 06:57:57 +00:00
parent a2e6e301ee
commit d9117ecff0
4 changed files with 49 additions and 9 deletions

View File

@ -5,7 +5,7 @@
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package infolog
* @copyright (c) 2003-9 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2003-10 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
@ -15,6 +15,19 @@
*/
class infolog_hooks
{
/**
* For which groups should no group acl be used: infolog group owners
*
* @param string|array $data
* @return boolean|array true, false or array with group-account_id's
*/
static function not_enum_group_acls($data)
{
$config = config::read('infolog');
return $config['group_owners'];
}
/**
* Hook called by link-class to include infolog in the appregistry of the linkage
*
@ -23,6 +36,15 @@ class infolog_hooks
*/
static function search_link($location)
{
// register our not_enum_group_acls hook, if not already registered
// can be removed after next infolog version update after 1.6
if ($GLOBALS['egw']->hooks->single('not_enum_group_acls',$acl_app) === false)
{
include(EGW_INCLUDE_ROOT.'/infolog/setup/setup.inc.php');
$GLOBALS['egw']->hooks->register_hooks('infolog',$setup_info['infolog']['hooks']);
unset($setup_info);
}
return array(
'query' => 'infolog.infolog_bo.link_query',
'title' => 'infolog.infolog_bo.link_title',

View File

@ -6,7 +6,7 @@
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package infolog
* @subpackage setup
* @copyright (c) 2003-8 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2003-10 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
@ -48,6 +48,7 @@ $setup_info['infolog']['hooks']['preferences'] = 'infolog_hooks::all_hooks';
$setup_info['infolog']['hooks']['settings'] = 'infolog_hooks::settings';
$setup_info['infolog']['hooks']['verify_settings'] = 'infolog_hooks::verify_settings';
$setup_info['infolog']['hooks']['admin'] = 'infolog_hooks::all_hooks';
$setup_info['infolog']['hooks']['not_enum_group_acls'] = 'infolog_hooks::not_enum_group_acls';
$setup_info['infolog']['hooks']['deleteaccount'] = 'infolog.infolog_so.change_delete_owner';
$setup_info['infolog']['hooks'][] = 'home';
$setup_info['infolog']['hooks']['addressbook_view'] = 'infolog.infolog_ui.hook_view';

View File

@ -122,10 +122,10 @@ class acl
/**
* Read acl records for $acl->account_id from reposity
*
* @internal
* @param boolean|array $no_groups=false if true, do not use memberships, if array do not use given groups
* @return array along with storing it in $acl->data. <br>
*/
function read_repository()
function read_repository($no_groups=false)
{
// For some reason, calling this via XML-RPC doesn't call the constructor.
// Here is yet another work around(tm) (jengo)
@ -133,9 +133,16 @@ class acl
{
$this->acl();
}
$acl_acc_list = $GLOBALS['egw']->accounts->memberships($this->account_id,true);
@array_unshift($acl_acc_list,$this->account_id);
if ($no_groups === true)
{
$acl_acc_list = $this->account_id;
}
else
{
$acl_acc_list = $GLOBALS['egw']->accounts->memberships($this->account_id,true);
if (is_array($no_groups)) $acl_acc_list = array_diff($acl_acc_list,$no_groups);
array_unshift($acl_acc_list,$this->account_id);
}
$this->data = Array();
foreach($this->db->select(acl::TABLE,'*',array('acl_account' => $acl_acc_list ),__LINE__,__FILE__) as $row)

View File

@ -99,7 +99,9 @@ class uiaclprefs
$no_privat_grants = $owner != $GLOBALS['egw_info']['user']['account_id'];
}
$this->acl = new acl((int)$owner);
$this->acl->read_repository();
// should we enumerate group acl (does app use it), eg. addressbook does NOT use group ACL's but group addressbooks
$not_enum_group_acls = $acl_app == 'addressbook' ? true : $GLOBALS['egw']->hooks->single('not_enum_group_acls',$acl_app);
$this->acl->read_repository($not_enum_group_acls);
if ($_POST['save'] || $_POST['apply'])
{
@ -223,7 +225,15 @@ class uiaclprefs
$totalentries = $GLOBALS['egw']->accounts->total;
$shownentries = count($accounts);
$memberships = $GLOBALS['egw']->accounts->memberships($owner,true);
if ($not_enum_group_acls === true)
{
$memberships = array();
}
else
{
$memberships = $GLOBALS['egw']->accounts->memberships($owner,true);
if (is_array($not_enum_group_acls)) $memberships = array_diff($memberships,$not_enum_group_acls);
}
$header_type = '';
$processed = Array();
foreach((array)$accounts as $uid => $data)