isSharedFile() doesn't detect all shares, just use getUsersSharingFile() directly either you get a list of users or not
This commit is contained in:
parent
2d267501a1
commit
40efeb9187
|
@ -113,14 +113,10 @@ class Proxy extends \OC_FileProxy {
|
|||
$encData = Crypt::symmetricEncryptFileContentKeyfile( $data );
|
||||
|
||||
// Check if the keyfile needs to be shared
|
||||
if ( \OCP\Share::isSharedFile( $filePath ) ) {
|
||||
if ( ($userIds = \OCP\Share::getUsersSharingFile( $filePath, true )) ) {
|
||||
|
||||
// $fileOwner = \OC\Files\Filesystem::getOwner( $path );
|
||||
|
||||
// List everyone sharing the file
|
||||
//TODO check, is this path always the path to the source file?
|
||||
$userIds = \OCP\Share::getUsersSharingFile( $filePath, true );
|
||||
|
||||
$publicKeys = Keymanager::getPublicKeys( $rootView, $userIds );
|
||||
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
|
|
@ -109,40 +109,6 @@ class Share {
|
|||
|
||||
}
|
||||
|
||||
public static function isSharedFile( $path ) {
|
||||
|
||||
$fPath = self::prepFileTarget( $path );
|
||||
|
||||
// Fetch all shares of this file path from DB
|
||||
$query = \OC_DB::prepare(
|
||||
'SELECT
|
||||
id
|
||||
FROM
|
||||
`*PREFIX*share`
|
||||
WHERE
|
||||
file_target = ?'
|
||||
);
|
||||
|
||||
$result = $query->execute( array( $fPath ) );
|
||||
|
||||
if ( \OC_DB::isError( $result ) ) {
|
||||
|
||||
\OC_Log::write( 'OCP\Share', \OC_DB::getErrorMessage( $result ) . ', path=' . $fPath, \OC_Log::ERROR );
|
||||
|
||||
}
|
||||
|
||||
if ( $result->fetchRow() !== false ) {
|
||||
|
||||
return true;
|
||||
|
||||
} else {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Find which users can access a shared item
|
||||
* @param $path to the file
|
||||
|
|
Loading…
Reference in New Issue