[turba] Restricting user list when sharing address book

Davide Della Giustina davide.dellagiustina at ascotlc.it
Thu Mar 23 11:45:27 PST 2006


Chuck Hagenbuch <chuck <at> horde.org> writes:

> 
> Quoting Davide Della Giustina <davide.dellagiustina <at> ascotlc.it>:
> 
> > Is there any method to let a user see *only* his group ?
> 
> Not currently. It'd be a pretty simple change if people are in favor  
> of it. There are other places we've restricted things to just a user's  
> groups and have gotten feedback that users need to see outside their  
> own groups sometimes. I can go either way; I suppose it could also be  
> a configuration option but I'd rather not go that route for consistency.
> -chuck
 
Well... I'm no php programmer but i believe something like that should be okay:
/horde/templates/shares/edit.inc

//Actual user
$whoami = $auth->getAuth();
//Groups the user is in
$withami = $groups->getGroupMemberships($whoami);
// Every user that is in the same group as the actual user
$list = array();
foreach ($withami as $idgr => $grname)
{
 $list = $groups->listAllUsers($idgr);
}
And using:
    <?php foreach ($list as $user) { if ($user != $owner) { 
      <option value="<?php echo htmlspecialchars($user) ?>">
	<?php 
	echo htmlspecialchars(Auth::removeHook($user)) 
	?>
...
when listing users and using
    <?php 
    foreach ( $withami as $gid => $group ) { if (empty($groupperms[$gid])) {
    ?>
listing groups.
I did not test this config extensively but neither found any bug so far...
If somebody wishes the entire text I would gladly post it.

Regards,
 Davide



More information about the turba mailing list