diff options
Diffstat (limited to 'lib')
30 files changed, 288 insertions, 383 deletions
diff --git a/lib/base.php b/lib/base.php index a4bb4f584f8..68178b06c5b 100644 --- a/lib/base.php +++ b/lib/base.php @@ -528,7 +528,7 @@ class OC { // // Questions about this code? Ask Lukas ;-) $currentUrl = substr(explode('?',$request->getRequestUri(), 2)[0], strlen(\OC::$WEBROOT)); - if($currentUrl === '/index.php/apps/user_saml/saml/acs') { + if($currentUrl === '/index.php/apps/user_saml/saml/acs' || $currentUrl === '/apps/user_saml/saml/acs') { return; } // For the "index.php" endpoint only a lax cookie is required. @@ -698,7 +698,7 @@ class OC { } OC_User::useBackend(new \OC\User\Database()); - OC_Group::useBackend(new \OC\Group\Database()); + \OC::$server->getGroupManager()->addBackend(new \OC\Group\Database()); // Subscribe to the hook \OCP\Util::connectHook( diff --git a/lib/composer/composer/ClassLoader.php b/lib/composer/composer/ClassLoader.php index 4626994fd4d..2c72175e772 100644 --- a/lib/composer/composer/ClassLoader.php +++ b/lib/composer/composer/ClassLoader.php @@ -374,9 +374,13 @@ class ClassLoader $first = $class[0]; if (isset($this->prefixLengthsPsr4[$first])) { - foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) { - if (0 === strpos($class, $prefix)) { - foreach ($this->prefixDirsPsr4[$prefix] as $dir) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath.'\\'; + if (isset($this->prefixDirsPsr4[$search])) { + foreach ($this->prefixDirsPsr4[$search] as $dir) { + $length = $this->prefixLengthsPsr4[$first][$search]; if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) { return $file; } diff --git a/lib/composer/composer/LICENSE b/lib/composer/composer/LICENSE index 1a28124886d..f27399a042d 100644 --- a/lib/composer/composer/LICENSE +++ b/lib/composer/composer/LICENSE @@ -1,5 +1,5 @@ -Copyright (c) 2016 Nils Adermann, Jordi Boggiano +Copyright (c) Nils Adermann, Jordi Boggiano Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/lib/l10n/ca.js b/lib/l10n/ca.js index daa9ae7a3d6..fbbf8fdd543 100644 --- a/lib/l10n/ca.js +++ b/lib/l10n/ca.js @@ -12,6 +12,7 @@ OC.L10N.register( "%1$s, %2$s, %3$s and %4$s" : "%1$s, %2$s, %3$s i %4$s", "%1$s, %2$s, %3$s, %4$s and %5$s" : "%1$s, %2$s, %3$s, %4$s i %5$s", "PHP %s or higher is required." : "Es requereix PHP %s o superior.", + "%sbit or higher PHP required." : "Es requereix PHP %s o superior.", "Server version %s or higher is required." : "Es requereix una versió de servidor %s o superior", "Server version %s or lower is required." : "Es requereix una versió de servidor %s o inferior", "Unknown filetype" : "Tipus de fitxer desconegut", diff --git a/lib/l10n/ca.json b/lib/l10n/ca.json index f6c692aef0d..13358e42a4f 100644 --- a/lib/l10n/ca.json +++ b/lib/l10n/ca.json @@ -10,6 +10,7 @@ "%1$s, %2$s, %3$s and %4$s" : "%1$s, %2$s, %3$s i %4$s", "%1$s, %2$s, %3$s, %4$s and %5$s" : "%1$s, %2$s, %3$s, %4$s i %5$s", "PHP %s or higher is required." : "Es requereix PHP %s o superior.", + "%sbit or higher PHP required." : "Es requereix PHP %s o superior.", "Server version %s or higher is required." : "Es requereix una versió de servidor %s o superior", "Server version %s or lower is required." : "Es requereix una versió de servidor %s o inferior", "Unknown filetype" : "Tipus de fitxer desconegut", diff --git a/lib/l10n/is.js b/lib/l10n/is.js index 3ecb4663bda..6294dbfeaf4 100644 --- a/lib/l10n/is.js +++ b/lib/l10n/is.js @@ -3,6 +3,7 @@ OC.L10N.register( { "Cannot write into \"config\" directory!" : "Get ekki skrifað í \"config\" möppuna!", "See %s" : "Skoðaðu %s", + "Sample configuration detected" : "Fann sýnisuppsetningu", "%1$s and %2$s" : "%1$s og %2$s", "%1$s, %2$s and %3$s" : "%1$s, %2$s og %3$s", "%1$s, %2$s, %3$s and %4$s" : "%1$s, %2$s, %3$s og %4$s", @@ -77,7 +78,7 @@ OC.L10N.register( "Cannot set expiration date. Expiration date is in the past" : "Get ekki stillt gildistímann. Gildistíminn er þegar runninn út", "Sharing backend %s not found" : "Deilingarbakendinn %s fannst ekki", "Sharing backend for %s not found" : "Deilingarbakendi fyrir %s fannst ekki", - "Sharing failed, because the user %s is the original sharer" : "Deiling %s mistókst, því notandinn %s er upprunalegur deilandi", + "Sharing failed, because the user %s is the original sharer" : "Deiling mistókst, því notandinn %s er upprunalegur deilandi", "Sharing %s failed, because resharing is not allowed" : "Deiling %s mistókst, því endurdeiling er ekki leyfð", "Cannot increase permissions of %s" : "Get ekki aukið aðgangsheimildir %s", "Expiration date is in the past" : "Gildistíminn er þegar runninn út", @@ -171,11 +172,19 @@ OC.L10N.register( "Storage unauthorized. %s" : "Gagnageymsla ekki auðkennd. %s", "Storage incomplete configuration. %s" : "Ófullgerð uppsetning gagnageymslu. %s", "Storage connection error. %s" : "Villa í tengingu við gagnageymslu. %s", + "Storage is temporarily not available" : "Gagnageymsla ekki tiltæk í augnablikinu", "Storage connection timeout. %s" : "Gagnageymsla féll á tíma. %s", "4-byte characters are not supported in file names" : "4-bæta stafir eru ekki leyfilegir í skráaheitum", + "App directory already exists" : "Forritsmappan er þegar til", + "Can't create app folder. Please fix permissions. %s" : "Gat ekki búið til forritsmöppu. Lagaðu aðgangsheimildir. %s", + "Archive does not contain a directory named %s" : "Safnskráin inniheldur ekki möppu með heitinu %s", + "No source specified when installing app" : "Enginn uppruni tilgreindur þegar forrit var sett upp", + "No href specified when installing app from http" : "Ekkert href tilgreint þegar forrit var sett upp í gegnum http", + "No path specified when installing app from local file" : "Engin slóð tilgreind þegar forrit var sett upp úr staðværri skrá", "Logging" : "Skráning annáls", "Recommended" : "Mælt með", "Microsoft Windows Platform is not supported" : "Ekki er stuðningur við Microsoft Windows stýrikerfið", + "Running Nextcloud Server on the Microsoft Windows platform is not supported. We suggest you use a Linux server in a virtual machine if you have no option for migrating the server itself." : "Ekki er stuðningur við að keyra Nextcloud-þjón á Microsoft Windows stýrikerfinu. Við stingum upp á því að þú notir Linux-þjón í sýndarvél, ef þú hefur ekki kost á að yfirfæra sjálfan þjóninn í Linux.", "Storage not available" : "Gagnageymsla ekki tiltæk" }, "nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);"); diff --git a/lib/l10n/is.json b/lib/l10n/is.json index 9d49ab40f0f..48e91de5e47 100644 --- a/lib/l10n/is.json +++ b/lib/l10n/is.json @@ -1,6 +1,7 @@ { "translations": { "Cannot write into \"config\" directory!" : "Get ekki skrifað í \"config\" möppuna!", "See %s" : "Skoðaðu %s", + "Sample configuration detected" : "Fann sýnisuppsetningu", "%1$s and %2$s" : "%1$s og %2$s", "%1$s, %2$s and %3$s" : "%1$s, %2$s og %3$s", "%1$s, %2$s, %3$s and %4$s" : "%1$s, %2$s, %3$s og %4$s", @@ -75,7 +76,7 @@ "Cannot set expiration date. Expiration date is in the past" : "Get ekki stillt gildistímann. Gildistíminn er þegar runninn út", "Sharing backend %s not found" : "Deilingarbakendinn %s fannst ekki", "Sharing backend for %s not found" : "Deilingarbakendi fyrir %s fannst ekki", - "Sharing failed, because the user %s is the original sharer" : "Deiling %s mistókst, því notandinn %s er upprunalegur deilandi", + "Sharing failed, because the user %s is the original sharer" : "Deiling mistókst, því notandinn %s er upprunalegur deilandi", "Sharing %s failed, because resharing is not allowed" : "Deiling %s mistókst, því endurdeiling er ekki leyfð", "Cannot increase permissions of %s" : "Get ekki aukið aðgangsheimildir %s", "Expiration date is in the past" : "Gildistíminn er þegar runninn út", @@ -169,11 +170,19 @@ "Storage unauthorized. %s" : "Gagnageymsla ekki auðkennd. %s", "Storage incomplete configuration. %s" : "Ófullgerð uppsetning gagnageymslu. %s", "Storage connection error. %s" : "Villa í tengingu við gagnageymslu. %s", + "Storage is temporarily not available" : "Gagnageymsla ekki tiltæk í augnablikinu", "Storage connection timeout. %s" : "Gagnageymsla féll á tíma. %s", "4-byte characters are not supported in file names" : "4-bæta stafir eru ekki leyfilegir í skráaheitum", + "App directory already exists" : "Forritsmappan er þegar til", + "Can't create app folder. Please fix permissions. %s" : "Gat ekki búið til forritsmöppu. Lagaðu aðgangsheimildir. %s", + "Archive does not contain a directory named %s" : "Safnskráin inniheldur ekki möppu með heitinu %s", + "No source specified when installing app" : "Enginn uppruni tilgreindur þegar forrit var sett upp", + "No href specified when installing app from http" : "Ekkert href tilgreint þegar forrit var sett upp í gegnum http", + "No path specified when installing app from local file" : "Engin slóð tilgreind þegar forrit var sett upp úr staðværri skrá", "Logging" : "Skráning annáls", "Recommended" : "Mælt með", "Microsoft Windows Platform is not supported" : "Ekki er stuðningur við Microsoft Windows stýrikerfið", + "Running Nextcloud Server on the Microsoft Windows platform is not supported. We suggest you use a Linux server in a virtual machine if you have no option for migrating the server itself." : "Ekki er stuðningur við að keyra Nextcloud-þjón á Microsoft Windows stýrikerfinu. Við stingum upp á því að þú notir Linux-þjón í sýndarvél, ef þú hefur ekki kost á að yfirfæra sjálfan þjóninn í Linux.", "Storage not available" : "Gagnageymsla ekki tiltæk" },"pluralForm" :"nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);" }
\ No newline at end of file diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index be35f4d172f..fd43d468568 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -490,6 +490,9 @@ class Request implements \ArrayAccess, \Countable, IRequest { * @return bool */ private function cookieCheckRequired() { + if ($this->getHeader('OCS-APIREQUEST')) { + return false; + } if($this->getCookie(session_name()) === null && $this->getCookie('nc_token') === null) { return false; } diff --git a/lib/private/Encryption/Util.php b/lib/private/Encryption/Util.php index 3afa1bb9596..76e1200a1cb 100644 --- a/lib/private/Encryption/Util.php +++ b/lib/private/Encryption/Util.php @@ -273,8 +273,18 @@ class Util { $result = \OCP\User::getUsers(); } else { $result = array_merge($result, $users); + + $groupManager = \OC::$server->getGroupManager(); foreach ($groups as $group) { - $result = array_merge($result, \OC_Group::usersInGroup($group)); + $groupObject = $groupManager->get($group); + if ($groupObject) { + $foundUsers = $groupObject->searchUsers('', -1, 0); + $userIds = []; + foreach ($foundUsers as $user) { + $userIds[] = $user->getUID(); + } + $result = array_merge($result, $userIds); + } } } diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index b0527d801d6..9c3b786ae87 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -17,6 +17,7 @@ * @author TheSFReader <TheSFReader@gmail.com> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> + * @author Xuanwo <xuanwo@yunify.com> * * @license AGPL-3.0 * @@ -532,7 +533,7 @@ class Cache implements ICache { $this->connection->executeQuery($moveSql, [$targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId]); $this->connection->commit(); } else { - $this->connection->executeQuery($moveSql, [$targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId]); + $this->connection->executeQuery($moveSql, [$targetStorageId, $targetPath, md5($targetPath), \OC_Util::basename($targetPath), $newParentId, $sourceId]); } } else { $this->moveFromCacheFallback($sourceCache, $sourcePath, $targetPath); @@ -594,6 +595,10 @@ class Cache implements ICache { // normalize pattern $pattern = $this->normalize($pattern); + if ($pattern === '%%') { + return []; + } + $sql = ' SELECT `fileid`, `storage`, `path`, `parent`, `name`, @@ -645,9 +650,22 @@ class Cache implements ICache { $builder = \OC::$server->getDatabaseConnection()->getQueryBuilder(); $query = $builder->select(['fileid', 'storage', 'path', 'parent', 'name', 'mimetype', 'mimepart', 'size', 'mtime', 'storage_mtime', 'encrypted', 'etag', 'permissions', 'checksum']) - ->from('filecache') - ->where($builder->expr()->eq('storage', $builder->createNamedParameter($this->getNumericStorageId()))) - ->andWhere($this->querySearchHelper->searchOperatorToDBExpr($builder, $searchQuery->getSearchOperation())); + ->from('filecache', 'file'); + + $query->where($builder->expr()->eq('storage', $builder->createNamedParameter($this->getNumericStorageId()))); + + if ($this->querySearchHelper->shouldJoinTags($searchQuery->getSearchOperation())) { + $query + ->innerJoin('file', 'vcategory_to_object', 'tagmap', $builder->expr()->eq('file.fileid', 'tagmap.objid')) + ->innerJoin('tagmap', 'vcategory', 'tag', $builder->expr()->andX( + $builder->expr()->eq('tagmap.type', 'tag.type'), + $builder->expr()->eq('tagmap.categoryid', 'tag.id') + )) + ->andWhere($builder->expr()->eq('tag.type', $builder->createNamedParameter('files'))) + ->andWhere($builder->expr()->eq('tag.uid', $builder->createNamedParameter($searchQuery->getUser()->getUID()))); + } + + $query->andWhere($this->querySearchHelper->searchOperatorToDBExpr($builder, $searchQuery->getSearchOperation())); if ($searchQuery->getLimit()) { $query->setMaxResults($searchQuery->getLimit()); @@ -660,7 +678,7 @@ class Cache implements ICache { return $this->searchResultToCacheEntries($result); } - /** + /** * Search for files by tag of a given users. * * Note that every user can tag files differently. diff --git a/lib/private/Files/Cache/QuerySearchHelper.php b/lib/private/Files/Cache/QuerySearchHelper.php index 931f258ec5b..7d8098f0efa 100644 --- a/lib/private/Files/Cache/QuerySearchHelper.php +++ b/lib/private/Files/Cache/QuerySearchHelper.php @@ -49,6 +49,8 @@ class QuerySearchHelper { ISearchComparison::COMPARE_LESS_THAN_EQUAL => 'lt' ]; + const TAG_FAVORITE = '_$!<Favorite>!$_'; + /** @var IMimeTypeLoader */ private $mimetypeLoader; @@ -61,6 +63,23 @@ class QuerySearchHelper { $this->mimetypeLoader = $mimetypeLoader; } + /** + * Whether or not the tag tables should be joined to complete the search + * + * @param ISearchOperator $operator + * @return boolean + */ + public function shouldJoinTags(ISearchOperator $operator) { + if ($operator instanceof ISearchBinaryOperator) { + return array_reduce($operator->getArguments(), function ($shouldJoin, ISearchOperator $operator) { + return $shouldJoin || $this->shouldJoinTags($operator); + }, false); + } else if ($operator instanceof ISearchComparison) { + return $operator->getField() === 'tagname' || $operator->getField() === 'favorite'; + } + return false; + } + public function searchOperatorToDBExpr(IQueryBuilder $builder, ISearchOperator $operator) { $expr = $builder->expr(); if ($operator instanceof ISearchBinaryOperator) { @@ -116,6 +135,11 @@ class QuerySearchHelper { throw new \InvalidArgumentException('Unsupported query value for mimetype: ' . $value . ', only values in the format "mime/type" or "mime/%" are supported'); } } + } else if ($field === 'favorite') { + $field = 'tag.category'; + $value = self::TAG_FAVORITE; + } else if ($field === 'tagname') { + $field = 'tag.category'; } return [$field, $value, $type]; } @@ -125,13 +149,17 @@ class QuerySearchHelper { 'mimetype' => 'string', 'mtime' => 'integer', 'name' => 'string', - 'size' => 'integer' + 'size' => 'integer', + 'tagname' => 'string', + 'favorite' => 'boolean' ]; $comparisons = [ 'mimetype' => ['eq', 'like'], 'mtime' => ['eq', 'gt', 'lt', 'gte', 'lte'], 'name' => ['eq', 'like'], - 'size' => ['eq', 'gt', 'lt', 'gte', 'lte'] + 'size' => ['eq', 'gt', 'lt', 'gte', 'lte'], + 'tagname' => ['eq', 'like'], + 'favorite' => ['eq'], ]; if (!isset($types[$operator->getField()])) { diff --git a/lib/private/Files/Search/SearchQuery.php b/lib/private/Files/Search/SearchQuery.php index 8a0478ae98e..c1da5220516 100644 --- a/lib/private/Files/Search/SearchQuery.php +++ b/lib/private/Files/Search/SearchQuery.php @@ -24,6 +24,7 @@ namespace OC\Files\Search; use OCP\Files\Search\ISearchOperator; use OCP\Files\Search\ISearchOrder; use OCP\Files\Search\ISearchQuery; +use OCP\IUser; class SearchQuery implements ISearchQuery { /** @var ISearchOperator */ @@ -34,6 +35,8 @@ class SearchQuery implements ISearchQuery { private $offset; /** @var ISearchOrder[] */ private $order; + /** @var IUser */ + private $user; /** * SearchQuery constructor. @@ -42,12 +45,14 @@ class SearchQuery implements ISearchQuery { * @param int $limit * @param int $offset * @param array $order + * @param IUser $user */ - public function __construct(ISearchOperator $searchOperation, $limit, $offset, array $order) { + public function __construct(ISearchOperator $searchOperation, $limit, $offset, array $order, IUser $user) { $this->searchOperation = $searchOperation; $this->limit = $limit; $this->offset = $offset; $this->order = $order; + $this->user = $user; } /** @@ -77,4 +82,11 @@ class SearchQuery implements ISearchQuery { public function getOrder() { return $this->order; } + + /** + * @return IUser + */ + public function getUser() { + return $this->user; + } } diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 6e5799be34c..5a57532f71c 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -795,4 +795,11 @@ abstract class Common implements Storage, ILockingStorage { public function setAvailability($isAvailable) { $this->getStorageCache()->setAvailability($isAvailable); } + + /** + * @return bool + */ + public function needsPartFile() { + return true; + } } diff --git a/lib/private/Files/Storage/Wrapper/Wrapper.php b/lib/private/Files/Storage/Wrapper/Wrapper.php index 71b64d8c82c..d7cd4b729db 100644 --- a/lib/private/Files/Storage/Wrapper/Wrapper.php +++ b/lib/private/Files/Storage/Wrapper/Wrapper.php @@ -610,4 +610,11 @@ class Wrapper implements \OC\Files\Storage\Storage, ILockingStorage { $this->getWrapperStorage()->changeLock($path, $type, $provider); } } + + /** + * @return bool + */ + public function needsPartFile() { + return $this->getWrapperStorage()->needsPartFile(); + } } diff --git a/lib/private/Log/File.php b/lib/private/Log/File.php index be8b72b3a3f..4c7ef446a05 100644 --- a/lib/private/Log/File.php +++ b/lib/private/Log/File.php @@ -14,6 +14,7 @@ * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Pulzer <t.pulzer@kniel.de> * @author Vincent Petry <pvince81@owncloud.com> + * @author Roger Szabo <roger.szabo@web.de> * * @license AGPL-3.0 * @@ -101,6 +102,7 @@ class File { } else { $user = '--'; } + $userAgent = $request->getHeader('User-Agent') ?: '--'; $version = $config->getValue('version', ''); $entry = compact( 'reqId', @@ -112,6 +114,7 @@ class File { 'method', 'url', 'user', + 'userAgent', 'version' ); $entry = json_encode($entry); diff --git a/lib/private/OCS/Provider.php b/lib/private/OCS/Provider.php index 7d53479c6e2..2e9ed85b67b 100644 --- a/lib/private/OCS/Provider.php +++ b/lib/private/OCS/Provider.php @@ -70,6 +70,23 @@ class Provider extends \OCP\AppFramework\Controller { ]; } + if ($this->appManager->isEnabledForUser('federation')) { + if (isset($services['FEDERATED_SHARING'])) { + $services['FEDERATED_SHARING']['endpoints']['shared-secret'] = '/ocs/v2.php/cloud/shared-secret'; + $services['FEDERATED_SHARING']['endpoints']['system-address-book'] = '/remote.php/dav/addressbooks/system/system/system'; + $services['FEDERATED_SHARING']['endpoints']['carddav-user'] = 'system'; + } else { + $services['FEDERATED_SHARING'] = [ + 'version' => 1, + 'endpoints' => [ + 'shared-secret' => '/ocs/v2.php/cloud/shared-secret', + 'system-address-book' => '/remote.php/dav/addressbooks/system/system/system', + 'carddav-user' => 'system' + ], + ]; + } + } + if($this->appManager->isEnabledForUser('activity')) { $services['ACTIVITY'] = [ 'version' => 1, diff --git a/lib/private/Preview/MP3.php b/lib/private/Preview/MP3.php index 804ec7fbcd9..05cd7c0edb1 100644 --- a/lib/private/Preview/MP3.php +++ b/lib/private/Preview/MP3.php @@ -61,24 +61,6 @@ class MP3 extends Provider { } } - return $this->getNoCoverThumbnail(); + return false; } - - /** - * Generates a default image when the file has no cover - * - * @return bool|\OCP\IImage false if the default image is missing or invalid - */ - private function getNoCoverThumbnail() { - $icon = \OC::$SERVERROOT . '/core/img/filetypes/audio.svg'; - - if(!file_exists($icon)) { - return false; - } - - $image = new \OC_Image(); - $image->loadFromFile($icon); - return $image->valid() ? $image : false; - } - } diff --git a/lib/private/Setup.php b/lib/private/Setup.php index 13e6ae2862b..df3f9e66630 100644 --- a/lib/private/Setup.php +++ b/lib/private/Setup.php @@ -451,6 +451,7 @@ class Setup { $content .= "\n RewriteCond %{REQUEST_FILENAME} !/status.php"; $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocs/v1.php"; $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocs/v2.php"; + $content .= "\n RewriteCond %{REQUEST_FILENAME} !/robots.txt"; $content .= "\n RewriteCond %{REQUEST_FILENAME} !/updater/"; $content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocs-provider/"; $content .= "\n RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/.*"; diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 6abaa7dd413..8aea6049de5 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -237,8 +237,19 @@ class Share extends Constants { if (\OCP\DB::isError($result)) { \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OCP\Util::ERROR); } else { + $groupManager = \OC::$server->getGroupManager(); while ($row = $result->fetchRow()) { - $usersInGroup = \OC_Group::usersInGroup($row['share_with']); + + $usersInGroup = []; + $group = $groupManager->get($row['share_with']); + if ($group) { + $users = $group->searchUsers('', -1, 0); + $userIds = array(); + foreach ($users as $user) { + $userIds[] = $user->getUID(); + } + $usersInGroup = $userIds; + } $shares = array_merge($shares, $usersInGroup); if ($returnUserPaths) { foreach ($usersInGroup as $user) { @@ -258,10 +269,10 @@ class Share extends Constants { $query = \OC_DB::prepare(' SELECT `share_with` FROM `*PREFIX*share` - WHERE `item_source` = ? AND `share_type` = ? AND `item_type` IN (\'file\', \'folder\')', 1 + WHERE `item_source` = ? AND `share_type` IN (?, ?) AND `item_type` IN (\'file\', \'folder\')', 1 ); - $result = $query->execute(array($source, self::SHARE_TYPE_LINK)); + $result = $query->execute(array($source, self::SHARE_TYPE_LINK, self::SHARE_TYPE_EMAIL)); if (\OCP\DB::isError($result)) { \OCP\Util::writeLog('OCP\Share', \OC_DB::getErrorMessage(), \OCP\Util::ERROR); @@ -468,7 +479,11 @@ class Share extends Constants { //if didn't found a result than let's look for a group share. if(empty($shares) && $user !== null) { - $groups = \OC_Group::getUserGroups($user); + $userObject = \OC::$server->getUserManager()->get($user); + $groups = []; + if ($userObject) { + $groups = \OC::$server->getGroupManager()->getUserGroupIds($userObject); + } if (!empty($groups)) { $where = $fileDependentWhere . ' WHERE `' . $column . '` = ? AND `item_type` = ? AND `share_with` in (?)'; @@ -628,7 +643,18 @@ class Share extends Constants { if ((int)$item['share_type'] === self::SHARE_TYPE_USER) { $users[] = $item['share_with']; } else if ((int)$item['share_type'] === self::SHARE_TYPE_GROUP) { - $users = array_merge($users, \OC_Group::usersInGroup($item['share_with'])); + + $group = \OC::$server->getGroupManager()->get($item['share_with']); + $userIds = []; + if ($group) { + $users = $group->searchUsers('', -1, 0); + foreach ($users as $user) { + $userIds[] = $user->getUID(); + } + return $userIds; + } + + $users = array_merge($users, $userIds); } } } @@ -740,7 +766,19 @@ class Share extends Constants { throw new \Exception($message_t); } if ($shareWithinGroupOnly) { - $inGroup = array_intersect(\OC_Group::getUserGroups($uidOwner), \OC_Group::getUserGroups($shareWith)); + $userManager = \OC::$server->getUserManager(); + $groupManager = \OC::$server->getGroupManager(); + $userOwner = $userManager->get($uidOwner); + $userShareWith = $userManager->get($shareWith); + $groupsOwner = []; + $groupsShareWith = []; + if ($userOwner) { + $groupsOwner = $groupManager->getUserGroupIds($userOwner); + } + if ($userShareWith) { + $groupsShareWith = $groupManager->getUserGroupIds($userShareWith); + } + $inGroup = array_intersect($groupsOwner, $groupsShareWith); if (empty($inGroup)) { $message = 'Sharing %s failed, because the user ' .'%s is not a member of any groups that %s is a member of'; @@ -775,18 +813,22 @@ class Share extends Constants { } } } else if ($shareType === self::SHARE_TYPE_GROUP) { - if (!\OC_Group::groupExists($shareWith)) { + if (!\OC::$server->getGroupManager()->groupExists($shareWith)) { $message = 'Sharing %s failed, because the group %s does not exist'; $message_t = $l->t('Sharing %s failed, because the group %s does not exist', array($itemSourceName, $shareWith)); \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $shareWith), \OCP\Util::DEBUG); throw new \Exception($message_t); } if ($shareWithinGroupOnly && !\OC_Group::inGroup($uidOwner, $shareWith)) { - $message = 'Sharing %s failed, because ' - .'%s is not a member of the group %s'; - $message_t = $l->t('Sharing %s failed, because %s is not a member of the group %s', array($itemSourceName, $uidOwner, $shareWith)); - \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), \OCP\Util::DEBUG); - throw new \Exception($message_t); + $group = \OC::$server->getGroupManager()->get($shareWith); + $user = \OC::$server->getUserManager()->get($uidOwner); + if (!$group || !$user || !$group->inGroup($user)) { + $message = 'Sharing %s failed, because ' + . '%s is not a member of the group %s'; + $message_t = $l->t('Sharing %s failed, because %s is not a member of the group %s', array($itemSourceName, $uidOwner, $shareWith)); + \OCP\Util::writeLog('OCP\Share', sprintf($message, $itemSourceName, $uidOwner, $shareWith), \OCP\Util::DEBUG); + throw new \Exception($message_t); + } } // Check if the item source is already shared with the group, either from the same owner or a different user // The check for each user in the group is done inside the put() function @@ -804,7 +846,18 @@ class Share extends Constants { $group = $shareWith; $shareWith = array(); $shareWith['group'] = $group; - $shareWith['users'] = array_diff(\OC_Group::usersInGroup($group), array($uidOwner)); + + + $groupObject = \OC::$server->getGroupManager()->get($group); + $userIds = []; + if ($groupObject) { + $users = $groupObject->searchUsers('', -1, 0); + foreach ($users as $user) { + $userIds[] = $user->getUID(); + } + } + + $shareWith['users'] = array_diff($userIds, array($uidOwner)); } else if ($shareType === self::SHARE_TYPE_LINK) { $updateExistingShare = false; if (\OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_links', 'yes') == 'yes') { @@ -1057,7 +1110,9 @@ class Share extends Constants { $itemUnshared = true; break; } elseif ((int)$share['share_type'] === \OCP\Share::SHARE_TYPE_GROUP) { - if (\OC_Group::inGroup($uid, $share['share_with'])) { + $group = \OC::$server->getGroupManager()->get($share['share_with']); + $user = \OC::$server->getUserManager()->get($uid); + if ($group && $user && $group->inGroup($user)) { $groupShare = $share; } } elseif ((int)$share['share_type'] === self::$shareTypeGroupUserUnique && @@ -1746,7 +1801,12 @@ class Share extends Constants { $queryArgs[] = self::SHARE_TYPE_USER; $queryArgs[] = self::$shareTypeGroupUserUnique; $queryArgs[] = $shareWith; - $groups = \OC_Group::getUserGroups($shareWith); + + $user = \OC::$server->getUserManager()->get($shareWith); + $groups = []; + if ($user) { + $groups = \OC::$server->getGroupManager()->getUserGroupIds($user); + } if (!empty($groups)) { $placeholders = join(',', array_fill(0, count($groups), '?')); $where .= ' OR (`share_type` = ? AND `share_with` IN ('.$placeholders.')) '; @@ -2171,7 +2231,17 @@ class Share extends Constants { if (isset($shareWith['users'])) { $users = $shareWith['users']; } else { - $users = \OC_Group::usersInGroup($shareWith['group']); + $group = \OC::$server->getGroupManager()->get($shareWith['group']); + if ($group) { + $users = $group->searchUsers('', -1, 0); + $userIds = []; + foreach ($users as $user) { + $userIds[] = $user->getUID(); + } + $users = $userIds; + } else { + $users = []; + } } // remove current user from list if (in_array(\OCP\User::getUser(), $users)) { @@ -2811,7 +2881,7 @@ class Share extends Constants { /** * @param IConfig $config - * @return bool + * @return bool */ public static function enforcePassword(IConfig $config) { $enforcePassword = $config->getAppValue('core', 'shareapi_enforce_links_password', 'no'); diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 23e8db34d7f..fe6472c31a0 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -642,7 +642,8 @@ class DefaultShareProvider implements IShareProvider { // exclude shares leading to trashbin on home storages $pathSections = explode('/', $data['path'], 2); // FIXME: would not detect rare md5'd home storage case properly - if ($pathSections[0] !== 'files' && explode(':', $data['storage_string_id'], 2)[0] === 'home') { + if ($pathSections[0] !== 'files' + && in_array(explode(':', $data['storage_string_id'], 2)[0], array('home', 'object'))) { return false; } return true; diff --git a/lib/private/Template/SCSSCacher.php b/lib/private/Template/SCSSCacher.php index d6f5a2c6fd3..744ea80761e 100644 --- a/lib/private/Template/SCSSCacher.php +++ b/lib/private/Template/SCSSCacher.php @@ -103,10 +103,17 @@ class SCSSCacher { private function isCached($fileNameCSS, $fileNameSCSS, ISimpleFolder $folder, $path) { try{ $cachedFile = $folder->getFile($fileNameCSS); - if( $cachedFile->getMTime() > filemtime($path.'/'.$fileNameSCSS) - && $cachedFile->getSize() > 0 ) { - return true; + if ($cachedFile->getSize() > 0) { + $depFile = $folder->getFile($fileNameCSS . '.deps'); + $deps = json_decode($depFile->getContent(), true); + + foreach ($deps as $file=>$mtime) { + if (!file_exists($file) || filemtime($file) > $mtime) { + return false; + } + } } + return true; } catch(NotFoundException $e) { return false; } @@ -140,6 +147,13 @@ class SCSSCacher { $cachedfile = $folder->newFile($fileNameCSS); } + $depFileName = $fileNameCSS . '.deps'; + try { + $depFile = $folder->getFile($depFileName); + } catch (NotFoundException $e) { + $depFile = $folder->newFile($depFileName); + } + // Compile try { $compiledScss = $scss->compile('@import "'.$fileNameSCSS.'";'); @@ -150,6 +164,7 @@ class SCSSCacher { try { $cachedfile->putContent($this->rebaseUrls($compiledScss, $webDir)); + $depFile->putContent(json_encode($scss->getParsedFiles())); $this->logger->debug($webDir.'/'.$fileNameSCSS.' compiled and successfully cached', ['app' => 'core']); return true; } catch(NotFoundException $e) { diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 30a9a80cef4..4427e4c48dc 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -365,7 +365,7 @@ class Updater extends BasicEmitter { // load authentication, filesystem and logging apps after // upgrading them. Other apps my need to rely on modifying // user and/or filesystem aspects. - \OC_App::loadApp($appId, false); + \OC_App::loadApp($appId); } } } diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 961f70f8a8e..bca9c46bfd0 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -204,9 +204,15 @@ class User implements IUser { // FIXME: Feels like an hack - suggestions? + $groupManager = \OC::$server->getGroupManager(); // We have to delete the user from all groups - foreach (\OC::$server->getGroupManager()->getUserGroupIds($this) as $groupId) { - \OC_Group::removeFromGroup($this->uid, $groupId); + foreach ($groupManager->getUserGroupIds($this) as $groupId) { + $group = $groupManager->get($groupId); + if ($group) { + \OC_Hook::emit("OC_Group", "pre_removeFromGroup", ["run" => true, "uid" => $this->uid, "gid" => $groupId]); + $group->removeUser($this); + \OC_Hook::emit("OC_User", "post_removeFromGroup", ["uid" => $this->uid, "gid" => $groupId]); + } } // Delete the user's keys in preferences \OC::$server->getConfig()->deleteAllUserValues($this->uid); diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index d5af15bdc20..f89f32f069a 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -134,10 +134,8 @@ class OC_App { * load a single app * * @param string $app - * @param bool $checkUpgrade whether an upgrade check should be done - * @throws \OC\NeedsUpdateException */ - public static function loadApp($app, $checkUpgrade = true) { + public static function loadApp($app) { self::$loadedApps[] = $app; $appPath = self::getAppPath($app); if($appPath === false) { @@ -149,9 +147,6 @@ class OC_App { if (is_file($appPath . '/appinfo/app.php')) { \OC::$server->getEventLogger()->start('load_app_' . $app, 'Load app: ' . $app); - if ($checkUpgrade and self::shouldUpgrade($app)) { - throw new \OC\NeedsUpdateException(); - } self::requireAppFile($app); if (self::isType($app, array('authentication'))) { // since authentication apps affect the "is app enabled for group" check, @@ -1138,7 +1133,7 @@ class OC_App { unset(self::$appVersion[$appId]); // run upgrade code if (file_exists($appPath . '/appinfo/update.php')) { - self::loadApp($appId, false); + self::loadApp($appId); include $appPath . '/appinfo/update.php'; } self::setupBackgroundJobs($appData['background-jobs']); @@ -1183,7 +1178,7 @@ class OC_App { return; } // load the app - self::loadApp($appId, false); + self::loadApp($appId); $dispatcher = OC::$server->getEventDispatcher(); diff --git a/lib/private/legacy/group.php b/lib/private/legacy/group.php deleted file mode 100644 index 6b58cb4c834..00000000000 --- a/lib/private/legacy/group.php +++ /dev/null @@ -1,302 +0,0 @@ -<?php -/** - * @copyright Copyright (c) 2016, ownCloud, Inc. - * - * @author Arthur Schiwon <blizzz@arthur-schiwon.de> - * @author Bart Visscher <bartv@thisnet.nl> - * @author Björn Schießle <bjoern@schiessle.org> - * @author Georg Ehrke <georg@owncloud.com> - * @author goodkiller <markopraakli@gmail.com> - * @author Jakob Sack <mail@jakobsack.de> - * @author Lukas Reschke <lukas@statuscode.ch> - * @author macjohnny <estebanmarin@gmx.ch> - * @author Michael Gapczynski <GapczynskiM@gmail.com> - * @author Morris Jobke <hey@morrisjobke.de> - * @author Qingping Hou <dave2008713@gmail.com> - * @author Robin Appelman <robin@icewind.nl> - * @author Robin McCorkell <robin@mccorkell.me.uk> - * @author Roeland Jago Douma <roeland@famdouma.nl> - * @author Thomas Müller <thomas.mueller@tmit.eu> - * - * @license AGPL-3.0 - * - * This code is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License, version 3, - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License, version 3, - * along with this program. If not, see <http://www.gnu.org/licenses/> - * - */ - -/** - * This class provides all methods needed for managing groups. - * - * Note that &run is deprecated and won't work anymore. - * Hooks provided: - * pre_createGroup(&run, gid) - * post_createGroup(gid) - * pre_deleteGroup(&run, gid) - * post_deleteGroup(gid) - * pre_addToGroup(&run, uid, gid) - * post_addToGroup(uid, gid) - * pre_removeFromGroup(&run, uid, gid) - * post_removeFromGroup(uid, gid) - */ -class OC_Group { - - /** - * @return \OC\Group\Manager - * @deprecated Use \OC::$server->getGroupManager(); - */ - public static function getManager() { - return \OC::$server->getGroupManager(); - } - - /** - * @return \OC\User\Manager - * @deprecated Use \OC::$server->getUserManager() - */ - private static function getUserManager() { - return \OC::$server->getUserManager(); - } - - /** - * set the group backend - * @param \OC\Group\Backend $backend The backend to use for user management - * @return bool - */ - public static function useBackend($backend) { - self::getManager()->addBackend($backend); - return true; - } - - /** - * remove all used backends - */ - public static function clearBackends() { - self::getManager()->clearBackends(); - } - - /** - * Try to create a new group - * @param string $gid The name of the group to create - * @return bool - * - * Tries to create a new group. If the group name already exists, false will - * be returned. Basic checking of Group name - * @deprecated Use \OC::$server->getGroupManager()->createGroup() instead - */ - public static function createGroup($gid) { - if (self::getManager()->createGroup($gid)) { - return true; - } else { - return false; - } - } - - /** - * delete a group - * @param string $gid gid of the group to delete - * @return bool - * - * Deletes a group and removes it from the group_user-table - * @deprecated Use \OC::$server->getGroupManager()->delete() instead - */ - public static function deleteGroup($gid) { - $group = self::getManager()->get($gid); - if ($group) { - if ($group->delete()) { - return true; - } - } - return false; - } - - /** - * is user in group? - * @param string $uid uid of the user - * @param string $gid gid of the group - * @return bool - * - * Checks whether the user is member of a group or not. - * @deprecated Use \OC::$server->getGroupManager->inGroup($user); - */ - public static function inGroup($uid, $gid) { - $group = self::getManager()->get($gid); - $user = self::getUserManager()->get($uid); - if ($group and $user) { - return $group->inGroup($user); - } - return false; - } - - /** - * Add a user to a group - * @param string $uid Name of the user to add to group - * @param string $gid Name of the group in which add the user - * @return bool - * - * Adds a user to a group. - * @deprecated Use \OC::$server->getGroupManager->addUser(); - */ - public static function addToGroup($uid, $gid) { - $group = self::getManager()->get($gid); - $user = self::getUserManager()->get($uid); - if ($group and $user) { - $group->addUser($user); - return true; - } else { - return false; - } - } - - /** - * Removes a user from a group - * @param string $uid Name of the user to remove from group - * @param string $gid Name of the group from which remove the user - * @return bool - * - * removes the user from a group. - */ - public static function removeFromGroup($uid, $gid) { - $group = self::getManager()->get($gid); - $user = self::getUserManager()->get($uid); - if ($group and $user) { - OC_Hook::emit("OC_Group", "pre_removeFromGroup", array("run" => true, "uid" => $uid, "gid" => $gid)); - $group->removeUser($user); - OC_Hook::emit("OC_User", "post_removeFromGroup", array("uid" => $uid, "gid" => $gid)); - return true; - } else { - return false; - } - } - - /** - * Get all groups a user belongs to - * @param string $uid Name of the user - * @return array an array of group names - * - * This function fetches all groups a user belongs to. It does not check - * if the user exists at all. - * @deprecated Use \OC::$server->getGroupManager->getUserGroupIds($user) - */ - public static function getUserGroups($uid) { - $user = self::getUserManager()->get($uid); - if ($user) { - return self::getManager()->getUserGroupIds($user); - } else { - return array(); - } - } - - /** - * get a list of all groups - * @param string $search - * @param int|null $limit - * @param int|null $offset - * @return array an array of group names - * - * Returns a list with all groups - */ - public static function getGroups($search = '', $limit = null, $offset = null) { - $groups = self::getManager()->search($search, $limit, $offset); - $groupIds = array(); - foreach ($groups as $group) { - $groupIds[] = $group->getGID(); - } - return $groupIds; - } - - /** - * check if a group exists - * - * @param string $gid - * @return bool - * @deprecated Use \OC::$server->getGroupManager->groupExists($gid) - */ - public static function groupExists($gid) { - return self::getManager()->groupExists($gid); - } - - /** - * get a list of all users in a group - * @param string $gid - * @param string $search - * @param int $limit - * @param int $offset - * @return array an array of user ids - */ - public static function usersInGroup($gid, $search = '', $limit = -1, $offset = 0) { - $group = self::getManager()->get($gid); - if ($group) { - $users = $group->searchUsers($search, $limit, $offset); - $userIds = array(); - foreach ($users as $user) { - $userIds[] = $user->getUID(); - } - return $userIds; - } else { - return array(); - } - } - - /** - * get a list of all users in several groups - * @param string[] $gids - * @param string $search - * @param int $limit - * @param int $offset - * @return array an array of user ids - */ - public static function usersInGroups($gids, $search = '', $limit = -1, $offset = 0) { - $users = array(); - foreach ($gids as $gid) { - // TODO Need to apply limits to groups as total - $users = array_merge(array_diff(self::usersInGroup($gid, $search, $limit, $offset), $users), $users); - } - return $users; - } - - /** - * get a list of all display names in a group - * @param string $gid - * @param string $search - * @param int $limit - * @param int $offset - * @return array an array of display names (value) and user ids(key) - * @deprecated Use \OC::$server->getGroupManager->displayNamesInGroup($gid, $search, $limit, $offset) - */ - public static function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) { - return self::getManager()->displayNamesInGroup($gid, $search, $limit, $offset); - } - - /** - * get a list of all display names in several groups - * @param array $gids - * @param string $search - * @param int $limit - * @param int $offset - * @return array an array of display names (Key) user ids (value) - */ - public static function displayNamesInGroups($gids, $search = '', $limit = -1, $offset = 0) { - $displayNames = array(); - foreach ($gids as $gid) { - // TODO Need to apply limits to groups as total - $diff = array_diff( - self::displayNamesInGroup($gid, $search, $limit, $offset), - $displayNames - ); - if ($diff) { - // A fix for LDAP users. array_merge loses keys... - $displayNames = $diff + $displayNames; - } - } - return $displayNames; - } -} diff --git a/lib/private/legacy/image.php b/lib/private/legacy/image.php index ed7dfce29a6..e26148bdf15 100644 --- a/lib/private/legacy/image.php +++ b/lib/private/legacy/image.php @@ -562,7 +562,11 @@ class OC_Image implements \OCP\IImage { break; case IMAGETYPE_JPEG: if (imagetypes() & IMG_JPG) { - $this->resource = imagecreatefromjpeg($imagePath); + if (getimagesize($imagePath) !== false) { + $this->resource = imagecreatefromjpeg($imagePath); + } else { + $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, array('app' => 'core')); + } } else { $this->logger->debug('OC_Image->loadFromFile, JPG images not supported: ' . $imagePath, array('app' => 'core')); } diff --git a/lib/private/legacy/template.php b/lib/private/legacy/template.php index 09e3d130f49..8535e018879 100644 --- a/lib/private/legacy/template.php +++ b/lib/private/legacy/template.php @@ -106,19 +106,9 @@ class OC_Template extends \OC\Template\Base { } } - OC_Util::addStyle("tooltip",null,true); OC_Util::addStyle('jquery-ui-fixes',null,true); OC_Util::addVendorStyle('jquery-ui/themes/base/jquery-ui',null,true); - OC_Util::addStyle("mobile",null,true); - OC_Util::addStyle("multiselect",null,true); - OC_Util::addStyle("fixes",null,true); - OC_Util::addStyle("global",null,true); - OC_Util::addStyle("apps",null,true); - OC_Util::addStyle("fonts",null,true); - OC_Util::addStyle("icons",null,true); - OC_Util::addStyle("header",null,true); - OC_Util::addStyle("inputs"); - OC_Util::addStyle("styles",null,true); + OC_Util::addStyle('server', null, true); // avatars \OC_Util::addScript('jquery.avatar', null, true); diff --git a/lib/private/legacy/user.php b/lib/private/legacy/user.php index 661242a659a..621ea3535b1 100644 --- a/lib/private/legacy/user.php +++ b/lib/private/legacy/user.php @@ -333,7 +333,9 @@ class OC_User { * @return bool */ public static function isAdminUser($uid) { - if (OC_Group::inGroup($uid, 'admin') && self::$incognitoMode === false) { + $group = \OC::$server->getGroupManager()->get('admin'); + $user = \OC::$server->getUserManager()->get($uid); + if ($group && $user && $group->inGroup($user) && self::$incognitoMode === false) { return true; } return false; diff --git a/lib/public/Files/Search/ISearchQuery.php b/lib/public/Files/Search/ISearchQuery.php index 5a701b321b1..531e285a593 100644 --- a/lib/public/Files/Search/ISearchQuery.php +++ b/lib/public/Files/Search/ISearchQuery.php @@ -21,6 +21,8 @@ namespace OCP\Files\Search; +use OCP\IUser; + /** * @since 12.0.0 */ @@ -54,4 +56,12 @@ interface ISearchQuery { * @since 12.0.0 */ public function getOrder(); + + /** + * The user that issued the search + * + * @return IUser + * @since 12.0.0 + */ + public function getUser(); } diff --git a/lib/public/Files/Storage.php b/lib/public/Files/Storage.php index 1532c84b621..213bbc0e549 100644 --- a/lib/public/Files/Storage.php +++ b/lib/public/Files/Storage.php @@ -458,4 +458,6 @@ interface Storage extends IStorage { * @param bool $isAvailable */ public function setAvailability($isAvailable); + + public function needsPartFile(); } |