getUsersSharingFile() no longer needed, use getSharingUsersArray() instead; fix filterShareReadyUsers() to return the correct results

This commit is contained in:
Björn Schießle 2013-04-18 20:02:27 +02:00
parent 5a7a64df08
commit 2bd338c49f
1 changed files with 3 additions and 27 deletions

View File

@ -657,14 +657,12 @@ class Util {
public function filterShareReadyUsers( $unfilteredUsers ) {
// This array will collect the filtered IDs
$userIds = array();
$readyIds = $unreadyIds = array();
// Loop through users and create array of UIDs that need new keyfiles
foreach ( $unfilteredUsers as $user ) {
$util = new Util( $this->view, $user );
$readyIds = $unreadyIds = array();
// Check that the user is encryption capable, or is the
// public system user 'ownCloud' (for public shares)
@ -690,7 +688,7 @@ class Util {
}
return array (
'ready' => $userIds
'ready' => $readyIds
, 'unready' => $unreadyIds
);
@ -810,7 +808,7 @@ class Util {
}
// Get public keys for each user, ready for generating sharekeys
$userPubKeys = Keymanager::getPublicKeys( $this->view, $filteredUids['ready'] ); // TODO: check this includes the owner's public key
$userPubKeys = Keymanager::getPublicKeys( $this->view, $filteredUids['ready'] );
\OC_FileProxy::$enabled = false;
@ -846,28 +844,6 @@ class Util {
return true;
}
/**
* @brief Returns the users who are sharing a file, including the file owner
* @param $path Relative path of the file, like files/file.txt
* @return $users array of UIDs
* @note This wraps the OCP\Share method, but includes the owner even if
* the file isn't registered in sharing API
*/
public function getUsersSharingFile( $path ) {
$users = \OCP\Share::getUsersSharingFile( $path, true, true );
// FIXME: this is returning empty :/
$owner = \OC\Files\Filesystem::getOwner( $path );
// trigger_error( var_export( $owner, 1));
$users[] = $owner;
return array_unique( $users );
}
/**
* @brief Find, sanitise and format users sharing a file
* @note This wraps other methods into a portable bundle