isSharedFile() doesn't detect all shares, just use getUsersSharingFile() directly either you get a list of users or not

This commit is contained in:
Björn Schießle 2013-02-22 16:02:27 +01:00
parent 2d267501a1
commit 40efeb9187
2 changed files with 1 additions and 39 deletions

View File

@ -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;

View File

@ -108,41 +108,7 @@ class Share {
return $path;
}
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