getUsersSharingFile() no longer needed, use getSharingUsersArray() instead; fix filterShareReadyUsers() to return the correct results
This commit is contained in:
parent
5a7a64df08
commit
2bd338c49f
|
@ -657,15 +657,13 @@ class Util {
|
||||||
public function filterShareReadyUsers( $unfilteredUsers ) {
|
public function filterShareReadyUsers( $unfilteredUsers ) {
|
||||||
|
|
||||||
// This array will collect the filtered IDs
|
// This array will collect the filtered IDs
|
||||||
$userIds = array();
|
$readyIds = $unreadyIds = array();
|
||||||
|
|
||||||
// Loop through users and create array of UIDs that need new keyfiles
|
// Loop through users and create array of UIDs that need new keyfiles
|
||||||
foreach ( $unfilteredUsers as $user ) {
|
foreach ( $unfilteredUsers as $user ) {
|
||||||
|
|
||||||
$util = new Util( $this->view, $user );
|
$util = new Util( $this->view, $user );
|
||||||
|
|
||||||
$readyIds = $unreadyIds = array();
|
|
||||||
|
|
||||||
// Check that the user is encryption capable, or is the
|
// Check that the user is encryption capable, or is the
|
||||||
// public system user 'ownCloud' (for public shares)
|
// public system user 'ownCloud' (for public shares)
|
||||||
if (
|
if (
|
||||||
|
@ -690,7 +688,7 @@ class Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
return array (
|
return array (
|
||||||
'ready' => $userIds
|
'ready' => $readyIds
|
||||||
, 'unready' => $unreadyIds
|
, 'unready' => $unreadyIds
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -810,7 +808,7 @@ class Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get public keys for each user, ready for generating sharekeys
|
// 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;
|
\OC_FileProxy::$enabled = false;
|
||||||
|
|
||||||
|
@ -846,28 +844,6 @@ class Util {
|
||||||
return true;
|
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
|
* @brief Find, sanitise and format users sharing a file
|
||||||
* @note This wraps other methods into a portable bundle
|
* @note This wraps other methods into a portable bundle
|
||||||
|
|
Loading…
Reference in New Issue