Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Jul 31, 2014
1 parent d02bd0e commit 682330d
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions turba/lib/Api.php
Expand Up @@ -190,7 +190,7 @@ public function getGalUid()
public function browse($path = '',
$properties = array('name', 'icon', 'browseable'))
{
global $injector, $session;
global $injector, $registry, $session;

// Strip off the application name if present
if (substr($path, 0, 5) == 'turba') {
Expand Down Expand Up @@ -269,17 +269,14 @@ public function browse($path = '',
// No backends are configured to provide shares
return array();
}
$addressbooks = $injector->getInstance('Turba_Shares')->listShares($parts[0], array(
'attributes' => $parts[0],
'perm' => Horde_Perms::READ
));

/* The last check returns all addressbooks for the requested
* user, but that does not mean the requesting user has access
* to them.
* Filter out those address books for which the requesting
* user has no access. */
$addressbooks = Turba::permissionsFilter($addressbooks);
$addressbooks = $injector->getInstance('Turba_Shares')
->listShares(
$registry->getAuth(),
array(
'attributes' => $parts[0],
'perm' => Horde_Perms::READ
)
);
}

$curpath = 'turba/' . $parts[0] . '/';
Expand Down

0 comments on commit 682330d

Please sign in to comment.