Compare commits
38 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6781f9fc76 | |||
| 7b6073c424 | |||
| 9dfea7ed32 | |||
| 35ba5ae2a0 | |||
| 847dfb0eb8 | |||
| fd42be531c | |||
| 946444a485 | |||
| 06a05700aa | |||
| d3e6feb7de | |||
| 621a872306 | |||
| 907894212b | |||
| 10aeef9786 | |||
| b6fe0f1f9a | |||
| 7d5ab15ac0 | |||
| c4da304170 | |||
| 311c4147bf | |||
| fe0a8b4df3 | |||
| 2536b1b983 | |||
| a2339f71b8 | |||
| dfb2577171 | |||
| 9a34ccb1e1 | |||
| 4ad74937dc | |||
| 5b89ebc3bb | |||
| 6286923022 | |||
| e0a825658d | |||
| 5805a9d505 | |||
| 4e5327f77a | |||
| 090c520d49 | |||
| d2e5368375 | |||
| 9b6d4c4a4f | |||
| 9791e918c0 | |||
| b3c390ea1e | |||
| 8b2a3994a6 | |||
| 39d0acc5f9 | |||
| f42483b80d | |||
| 736ed2f4e7 | |||
| 35efd6d0ff | |||
| 0060e5f28e |
+2
-2
@@ -1996,7 +1996,7 @@ steps:
|
||||
commands:
|
||||
- phpenmod xdebug
|
||||
- ./tests/drone-wait-objectstore.sh
|
||||
- TEST_SELECTION=PRIMARY-${OBJECT_STORE} ./autotest.sh sqlite
|
||||
- TEST_SELECTION=PRIMARY-s3 ./autotest.sh sqlite
|
||||
- wget https://codecov.io/bash -O codecov.sh
|
||||
- sh -c "if [ '$DRONE_BUILD_EVENT' = 'pull_request' ]; then bash codecov.sh -B $DRONE_BRANCH -C $DRONE_COMMIT -P $DRONE_PULL_REQUEST -t 117641e2-a9e8-4b7b-984b-ae872d9b05f5 -f tests/autotest-clover-sqlite.xml; fi"
|
||||
- sh -c "if [ '$DRONE_BUILD_EVENT' != 'pull_request' ]; then bash codecov.sh -B $DRONE_BRANCH -C $DRONE_COMMIT -t 117641e2-a9e8-4b7b-984b-ae872d9b05f5 -f tests/autotest-clover-sqlite.xml; fi"
|
||||
@@ -2027,7 +2027,7 @@ steps:
|
||||
commands:
|
||||
- phpenmod xdebug
|
||||
- ./tests/drone-wait-objectstore.sh
|
||||
- TEST_SELECTION=PRIMARY-${OBJECT_STORE} ./autotest.sh sqlite
|
||||
- TEST_SELECTION=PRIMARY-azure ./autotest.sh sqlite
|
||||
- wget https://codecov.io/bash -O codecov.sh
|
||||
- sh -c "if [ '$DRONE_BUILD_EVENT' = 'pull_request' ]; then bash codecov.sh -B $DRONE_BRANCH -C $DRONE_COMMIT -P $DRONE_PULL_REQUEST -t 117641e2-a9e8-4b7b-984b-ae872d9b05f5 -f tests/autotest-clover-sqlite.xml; fi"
|
||||
- sh -c "if [ '$DRONE_BUILD_EVENT' != 'pull_request' ]; then bash codecov.sh -B $DRONE_BRANCH -C $DRONE_COMMIT -t 117641e2-a9e8-4b7b-984b-ae872d9b05f5 -f tests/autotest-clover-sqlite.xml; fi"
|
||||
|
||||
@@ -319,7 +319,7 @@ class SyncService {
|
||||
|
||||
public function syncInstance(\Closure $progressCallback = null) {
|
||||
$systemAddressBook = $this->getLocalSystemAddressBook();
|
||||
$this->userManager->callForAllUsers(function($user) use ($systemAddressBook, $progressCallback) {
|
||||
$this->userManager->callForSeenUsers(function($user) use ($systemAddressBook, $progressCallback) {
|
||||
$this->updateUser($user);
|
||||
if (!is_null($progressCallback)) {
|
||||
$progressCallback();
|
||||
|
||||
@@ -92,7 +92,7 @@ class SyncBirthdayCalendar extends Command {
|
||||
$output->writeln("Start birthday calendar sync for all users ...");
|
||||
$p = new ProgressBar($output);
|
||||
$p->start();
|
||||
$this->userManager->callForAllUsers(function($user) use ($p) {
|
||||
$this->userManager->callForSeenUsers(function($user) use ($p) {
|
||||
$p->advance();
|
||||
|
||||
$userId = $user->getUID();
|
||||
|
||||
@@ -129,13 +129,6 @@ class CustomPropertiesBackend implements BackendInterface {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($node instanceof Directory
|
||||
&& $propFind->getDepth() !== 0
|
||||
) {
|
||||
// note: pre-fetching only supported for depth <= 1
|
||||
$this->loadChildrenProperties($node, $requestedProps);
|
||||
}
|
||||
|
||||
$props = $this->getProperties($node, $requestedProps);
|
||||
foreach ($props as $propName => $propValue) {
|
||||
$propFind->set($propName, $propValue);
|
||||
|
||||
@@ -93,7 +93,7 @@ class BirthdayCalendarController extends Controller {
|
||||
$this->config->setAppValue($this->appName, 'generateBirthdayCalendar', 'yes');
|
||||
|
||||
// add background job for each user
|
||||
$this->userManager->callForAllUsers(function(IUser $user) {
|
||||
$this->userManager->callForSeenUsers(function(IUser $user) {
|
||||
$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
|
||||
'userId' => $user->getUID(),
|
||||
]);
|
||||
|
||||
@@ -72,7 +72,7 @@ class RegenerateBirthdayCalendars implements IRepairStep {
|
||||
}
|
||||
|
||||
$output->info('Adding background jobs to regenerate birthday calendar');
|
||||
$this->userManager->callForAllUsers(function(IUser $user) {
|
||||
$this->userManager->callForSeenUsers(function(IUser $user) {
|
||||
$this->jobList->add(GenerateBirthdayCalendarBackgroundJob::class, [
|
||||
'userId' => $user->getUID(),
|
||||
'purgeBeforeGenerating' => true
|
||||
@@ -82,4 +82,4 @@ class RegenerateBirthdayCalendars implements IRepairStep {
|
||||
// if all were done, no need to redo the repair during next upgrade
|
||||
$this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,10 +226,6 @@ class CustomPropertiesBackendTest extends \Test\TestCase {
|
||||
->method('getPath')
|
||||
->will($this->returnValue('/dummypath/test.txt'));
|
||||
|
||||
$rootNode->expects($this->once())
|
||||
->method('getChildren')
|
||||
->will($this->returnValue(array($nodeSub)));
|
||||
|
||||
$this->tree->expects($this->at(0))
|
||||
->method('getNodeForPath')
|
||||
->with('/dummypath')
|
||||
|
||||
@@ -78,7 +78,7 @@ class BirthdayCalendarControllerTest extends TestCase {
|
||||
->with('dav', 'generateBirthdayCalendar', 'yes');
|
||||
|
||||
$this->userManager->expects($this->once())
|
||||
->method('callForAllUsers')
|
||||
->method('callForSeenUsers')
|
||||
->will($this->returnCallback(function($closure) {
|
||||
$user1 = $this->createMock(IUser::class);
|
||||
$user1->method('getUID')->will($this->returnValue('uid1'));
|
||||
|
||||
@@ -76,7 +76,7 @@ class RegenerateBirthdayCalendarsTest extends TestCase {
|
||||
->with('Adding background jobs to regenerate birthday calendar');
|
||||
|
||||
$this->userManager->expects($this->once())
|
||||
->method('callForAllUsers')
|
||||
->method('callForSeenUsers')
|
||||
->will($this->returnCallback(function($closure) {
|
||||
$user1 = $this->createMock(IUser::class);
|
||||
$user1->method('getUID')->will($this->returnValue('uid1'));
|
||||
@@ -128,10 +128,10 @@ class RegenerateBirthdayCalendarsTest extends TestCase {
|
||||
->with('Repair step already executed');
|
||||
|
||||
$this->userManager->expects($this->never())
|
||||
->method('callForAllUsers');
|
||||
->method('callForSeenUsers');
|
||||
|
||||
$this->migration->run($output);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,11 +262,8 @@ table th.column-last, table td.column-last {
|
||||
}
|
||||
|
||||
/* Multiselect bar */
|
||||
#filestable.multiselect {
|
||||
top: 51px;
|
||||
}
|
||||
table.multiselect thead {
|
||||
position: fixed;
|
||||
@include position('sticky');
|
||||
top: 94px;
|
||||
z-index: 55;
|
||||
-moz-box-sizing: border-box;
|
||||
@@ -275,7 +272,7 @@ table.multiselect thead {
|
||||
}
|
||||
|
||||
table.multiselect thead th {
|
||||
background-color: var(--color-main-background);
|
||||
background-color: var(--color-main-background-translucent);
|
||||
font-weight: bold;
|
||||
border-bottom: 0;
|
||||
}
|
||||
@@ -783,7 +780,7 @@ table.dragshadow td.size {
|
||||
tr {
|
||||
display: block;
|
||||
border-bottom: 1px solid var(--color-border);
|
||||
background-color: var(--color-main-background);
|
||||
background-color: var(--color-main-background-translucent);
|
||||
th {
|
||||
width: auto;
|
||||
border: none;
|
||||
|
||||
@@ -672,7 +672,7 @@
|
||||
actionHandler: function (filename, context) {
|
||||
var dir = context.$file.attr('data-path') || context.fileList.getCurrentDirectory();
|
||||
if (OCA.Files.App && OCA.Files.App.getActiveView() !== 'files') {
|
||||
OCA.Files.App.setActiveView('files');
|
||||
OCA.Files.App.setActiveView('files', {silent: true});
|
||||
OCA.Files.App.fileList.changeDirectory(OC.joinPaths(dir, filename), true, true);
|
||||
} else {
|
||||
context.fileList.changeDirectory(OC.joinPaths(dir, filename), true, false, parseInt(context.$file.attr('data-id'), 10));
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -73,6 +73,12 @@
|
||||
}
|
||||
.popovermenu {
|
||||
.linkPassMenu {
|
||||
input.error {
|
||||
border-color: var(--color-error) !important;
|
||||
&[type="submit"] {
|
||||
border-left: none;
|
||||
}
|
||||
}
|
||||
.share-pass-submit {
|
||||
width: auto !important;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,9 @@ class AccessToken extends Entity {
|
||||
|
||||
public function __construct() {
|
||||
$this->addType('id', 'int');
|
||||
$this->addType('token_id', 'int');
|
||||
$this->addType('client_id', 'int');
|
||||
$this->addType('hashed_code', 'string');
|
||||
$this->addType('encrypted_token', 'string');
|
||||
$this->addType('tokenId', 'int');
|
||||
$this->addType('clientId', 'int');
|
||||
$this->addType('hashedCode', 'string');
|
||||
$this->addType('encryptedToken', 'string');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
|
||||
namespace OC\Core;
|
||||
|
||||
use OC\Core\Notification\RemoveLinkSharesNotifier;
|
||||
use OC\DB\MissingIndexInformation;
|
||||
use OC\DB\SchemaWrapper;
|
||||
use OCP\AppFramework\App;
|
||||
@@ -54,6 +55,18 @@ class Application extends App {
|
||||
$server = $container->getServer();
|
||||
$eventDispatcher = $server->getEventDispatcher();
|
||||
|
||||
$notificationManager = $server->getNotificationManager();
|
||||
$notificationManager->registerNotifier(function() use ($server) {
|
||||
return new RemoveLinkSharesNotifier(
|
||||
$server->getL10NFactory()
|
||||
);
|
||||
}, function() use ($server) {
|
||||
return [
|
||||
'id' => 'core',
|
||||
'name' => 'core',
|
||||
];
|
||||
});
|
||||
|
||||
$eventDispatcher->addListener(IDBConnection::CHECK_MISSING_INDEXES_EVENT,
|
||||
function(GenericEvent $event) use ($container) {
|
||||
/** @var MissingIndexInformation $subject */
|
||||
|
||||
@@ -96,6 +96,7 @@ class Repair extends Command {
|
||||
if (!is_array($info)) {
|
||||
continue;
|
||||
}
|
||||
\OC_App::loadApp($app);
|
||||
$steps = $info['repair-steps']['post-migration'];
|
||||
foreach ($steps as $step) {
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
|
||||
*
|
||||
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OC\Core\Notification;
|
||||
|
||||
use OCP\L10N\IFactory;
|
||||
use OCP\Notification\INotification;
|
||||
use OCP\Notification\INotifier;
|
||||
|
||||
class RemoveLinkSharesNotifier implements INotifier {
|
||||
/** @var IFactory */
|
||||
private $l10nFactory;
|
||||
|
||||
public function __construct(IFactory $factory) {
|
||||
$this->l10nFactory = $factory;
|
||||
}
|
||||
|
||||
public function prepare(INotification $notification, $languageCode): INotification {
|
||||
if($notification->getApp() !== 'core') {
|
||||
throw new \InvalidArgumentException();
|
||||
}
|
||||
$l = $this->l10nFactory->get('core', $languageCode);
|
||||
|
||||
if ($notification->getSubject() === 'repair_exposing_links') {
|
||||
$notification->setParsedSubject($l->t('Some of your link shares have been removed'));
|
||||
$notification->setParsedMessage($l->t('Due to a security bug we had to remove some of your link shares. Please see the link for more information.'));
|
||||
$notification->setLink('https://nextcloud.com/security/advisory/?id=NC-SA-2019-003');
|
||||
return $notification;
|
||||
}
|
||||
|
||||
throw new \InvalidArgumentException('Invalid subject');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -41,4 +41,5 @@
|
||||
--font-face: $font-face;
|
||||
|
||||
--animation-quick: $animation-quick;
|
||||
--animation-slow: $animation-slow;
|
||||
}
|
||||
|
||||
@@ -82,6 +82,7 @@ $border-radius-pill: 100px !default;
|
||||
$font-face: 'Nunito', 'Open Sans', Frutiger, Calibri, 'Myriad Pro', Myriad, sans-serif !default;
|
||||
|
||||
$animation-quick: 100ms;
|
||||
$animation-slow: 300ms;
|
||||
|
||||
// various structure data
|
||||
$header-height: 50px;
|
||||
|
||||
Vendored
+3
-3
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -82,6 +82,11 @@
|
||||
var parts = name.split(':');
|
||||
var tagName = parts[1];
|
||||
var namespace = resolver(parts[0]);
|
||||
// make sure we can get elements
|
||||
if (typeof node === 'string') {
|
||||
var parser = new DOMParser()
|
||||
node = parser.parseFromString(node, 'text/xml')
|
||||
}
|
||||
if (node.getElementsByTagNameNS) {
|
||||
return node.getElementsByTagNameNS(namespace, tagName);
|
||||
}
|
||||
|
||||
@@ -352,6 +352,7 @@
|
||||
}
|
||||
var $input = $li.find('.linkPassText');
|
||||
$input.removeClass('error');
|
||||
$input.parent().find('input').removeClass('error');
|
||||
var password = $input.val();
|
||||
|
||||
if ($li.find('.linkPassText').attr('placeholder') === PASSWORD_PLACEHOLDER_MESSAGE_OPTIONAL) {
|
||||
@@ -380,6 +381,9 @@
|
||||
$loading.removeClass('inlineblock').addClass('hidden');
|
||||
},
|
||||
error: function(model, msg) {
|
||||
// Add visual feedback to both the input and the submit button
|
||||
$input.parent().find('input').addClass('error');
|
||||
|
||||
// destroy old tooltips
|
||||
var $container = $input.parent();
|
||||
$container.tooltip('destroy');
|
||||
|
||||
@@ -711,6 +711,7 @@ return array(
|
||||
'OC\\Core\\Migrations\\Version15000Date20181029084625' => $baseDir . '/core/Migrations/Version15000Date20181029084625.php',
|
||||
'OC\\Core\\Migrations\\Version16000Date20190207141427' => $baseDir . '/core/Migrations/Version16000Date20190207141427.php',
|
||||
'OC\\Core\\Migrations\\Version16000Date20190212081545' => $baseDir . '/core/Migrations/Version16000Date20190212081545.php',
|
||||
'OC\\Core\\Notification\\RemoveLinkSharesNotifier' => $baseDir . '/core/Notification/RemoveLinkSharesNotifier.php',
|
||||
'OC\\Core\\Service\\LoginFlowV2Service' => $baseDir . '/core/Service/LoginFlowV2Service.php',
|
||||
'OC\\DB\\Adapter' => $baseDir . '/lib/private/DB/Adapter.php',
|
||||
'OC\\DB\\AdapterMySQL' => $baseDir . '/lib/private/DB/AdapterMySQL.php',
|
||||
@@ -1018,6 +1019,7 @@ return array(
|
||||
'OC\\Repair\\OldGroupMembershipShares' => $baseDir . '/lib/private/Repair/OldGroupMembershipShares.php',
|
||||
'OC\\Repair\\Owncloud\\DropAccountTermsTable' => $baseDir . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php',
|
||||
'OC\\Repair\\Owncloud\\SaveAccountsTableData' => $baseDir . '/lib/private/Repair/Owncloud/SaveAccountsTableData.php',
|
||||
'OC\\Repair\\RemoveLinkShares' => $baseDir . '/lib/private/Repair/RemoveLinkShares.php',
|
||||
'OC\\Repair\\RemoveRootShares' => $baseDir . '/lib/private/Repair/RemoveRootShares.php',
|
||||
'OC\\Repair\\RepairInvalidShares' => $baseDir . '/lib/private/Repair/RepairInvalidShares.php',
|
||||
'OC\\Repair\\RepairMimeTypes' => $baseDir . '/lib/private/Repair/RepairMimeTypes.php',
|
||||
|
||||
@@ -741,6 +741,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
|
||||
'OC\\Core\\Migrations\\Version15000Date20181029084625' => __DIR__ . '/../../..' . '/core/Migrations/Version15000Date20181029084625.php',
|
||||
'OC\\Core\\Migrations\\Version16000Date20190207141427' => __DIR__ . '/../../..' . '/core/Migrations/Version16000Date20190207141427.php',
|
||||
'OC\\Core\\Migrations\\Version16000Date20190212081545' => __DIR__ . '/../../..' . '/core/Migrations/Version16000Date20190212081545.php',
|
||||
'OC\\Core\\Notification\\RemoveLinkSharesNotifier' => __DIR__ . '/../../..' . '/core/Notification/RemoveLinkSharesNotifier.php',
|
||||
'OC\\Core\\Service\\LoginFlowV2Service' => __DIR__ . '/../../..' . '/core/Service/LoginFlowV2Service.php',
|
||||
'OC\\DB\\Adapter' => __DIR__ . '/../../..' . '/lib/private/DB/Adapter.php',
|
||||
'OC\\DB\\AdapterMySQL' => __DIR__ . '/../../..' . '/lib/private/DB/AdapterMySQL.php',
|
||||
@@ -1048,6 +1049,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c
|
||||
'OC\\Repair\\OldGroupMembershipShares' => __DIR__ . '/../../..' . '/lib/private/Repair/OldGroupMembershipShares.php',
|
||||
'OC\\Repair\\Owncloud\\DropAccountTermsTable' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/DropAccountTermsTable.php',
|
||||
'OC\\Repair\\Owncloud\\SaveAccountsTableData' => __DIR__ . '/../../..' . '/lib/private/Repair/Owncloud/SaveAccountsTableData.php',
|
||||
'OC\\Repair\\RemoveLinkShares' => __DIR__ . '/../../..' . '/lib/private/Repair/RemoveLinkShares.php',
|
||||
'OC\\Repair\\RemoveRootShares' => __DIR__ . '/../../..' . '/lib/private/Repair/RemoveRootShares.php',
|
||||
'OC\\Repair\\RepairInvalidShares' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairInvalidShares.php',
|
||||
'OC\\Repair\\RepairMimeTypes' => __DIR__ . '/../../..' . '/lib/private/Repair/RepairMimeTypes.php',
|
||||
|
||||
@@ -1170,6 +1170,10 @@ class QueryBuilder implements IQueryBuilder {
|
||||
* @return string
|
||||
*/
|
||||
public function getTableName($table) {
|
||||
if ($table instanceof IQueryFunction) {
|
||||
return (string) $table;
|
||||
}
|
||||
|
||||
$table = $this->prefixTableName($table);
|
||||
return $this->helper->quoteColumnName($table);
|
||||
}
|
||||
|
||||
@@ -76,14 +76,9 @@ class Swift implements IObjectStore {
|
||||
* @throws \Exception from openstack lib when something goes wrong
|
||||
*/
|
||||
public function writeObject($urn, $stream) {
|
||||
$handle = $stream;
|
||||
|
||||
$meta = stream_get_meta_data($stream);
|
||||
if (!(isset($meta['seekable']) && $meta['seekable'] === true)) {
|
||||
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile('swiftwrite');
|
||||
file_put_contents($tmpFile, $stream);
|
||||
$handle = fopen($tmpFile, 'rb');
|
||||
}
|
||||
$tmpFile = \OC::$server->getTempManager()->getTemporaryFile('swiftwrite');
|
||||
file_put_contents($tmpFile, $stream);
|
||||
$handle = fopen($tmpFile, 'rb');
|
||||
|
||||
$this->getContainer()->createObject([
|
||||
'name' => $urn,
|
||||
|
||||
@@ -48,6 +48,7 @@ use OC\Repair\NC16\CleanupCardDAVPhotoCache;
|
||||
use OC\Repair\OldGroupMembershipShares;
|
||||
use OC\Repair\Owncloud\DropAccountTermsTable;
|
||||
use OC\Repair\Owncloud\SaveAccountsTableData;
|
||||
use OC\Repair\RemoveLinkShares;
|
||||
use OC\Repair\RemoveRootShares;
|
||||
use OC\Repair\RepairInvalidShares;
|
||||
use OC\Repair\RepairMimeTypes;
|
||||
@@ -55,6 +56,7 @@ use OC\Repair\SqliteAutoincrement;
|
||||
use OC\Template\JSCombiner;
|
||||
use OC\Template\SCSSCacher;
|
||||
use OCP\AppFramework\QueryException;
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\IRepairStep;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
||||
@@ -152,6 +154,7 @@ class Repair implements IOutput {
|
||||
new SetVcardDatabaseUID(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getLogger()),
|
||||
new CleanupCardDAVPhotoCache(\OC::$server->getConfig(), \OC::$server->getAppDataDir('dav-photocache'), \OC::$server->getLogger()),
|
||||
new AddClenupLoginFlowV2BackgroundJob(\OC::$server->getJobList()),
|
||||
new RemoveLinkShares(\OC::$server->getDatabaseConnection(), \OC::$server->getConfig(), \OC::$server->getGroupManager(), \OC::$server->getNotificationManager(), \OC::$server->query(ITimeFactory::class)),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,236 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
|
||||
*
|
||||
* @author Roeland Jago Douma <roeland@famdouma.nl>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* 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
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OC\Repair;
|
||||
|
||||
use Doctrine\DBAL\Driver\Statement;
|
||||
use OCP\AppFramework\Utility\ITimeFactory;
|
||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||
use OCP\IConfig;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\IGroupManager;
|
||||
use OCP\Migration\IOutput;
|
||||
use OCP\Migration\IRepairStep;
|
||||
use OCP\Notification\IManager;
|
||||
|
||||
class RemoveLinkShares implements IRepairStep {
|
||||
/** @var IDBConnection */
|
||||
private $connection;
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var string[] */
|
||||
private $userToNotify = [];
|
||||
/** @var IGroupManager */
|
||||
private $groupManager;
|
||||
/** @var IManager */
|
||||
private $notificationManager;
|
||||
/** @var ITimeFactory */
|
||||
private $timeFactory;
|
||||
|
||||
public function __construct(IDBConnection $connection,
|
||||
IConfig $config,
|
||||
IGroupManager $groupManager,
|
||||
IManager $notificationManager,
|
||||
ITimeFactory $timeFactory) {
|
||||
$this->connection = $connection;
|
||||
$this->config = $config;
|
||||
$this->groupManager = $groupManager;
|
||||
$this->notificationManager = $notificationManager;
|
||||
$this->timeFactory = $timeFactory;
|
||||
}
|
||||
|
||||
|
||||
public function getName(): string {
|
||||
return 'Remove potentially over exposing share links';
|
||||
}
|
||||
|
||||
private function shouldRun(): bool {
|
||||
$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
|
||||
|
||||
if (version_compare($versionFromBeforeUpdate, '14.0.11', '<')) {
|
||||
return true;
|
||||
}
|
||||
if (version_compare($versionFromBeforeUpdate, '15.0.8', '<')) {
|
||||
return true;
|
||||
}
|
||||
if (version_compare($versionFromBeforeUpdate, '16.0.0', '<=')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the share
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
private function deleteShare(int $id): void {
|
||||
$qb = $this->connection->getQueryBuilder();
|
||||
$qb->delete('share')
|
||||
->where($qb->expr()->eq('id', $qb->createNamedParameter($id)));
|
||||
$qb->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the total of affected shares
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
private function getTotal(): int {
|
||||
$subSubQuery = $this->connection->getQueryBuilder();
|
||||
$subSubQuery->select('*')
|
||||
->from('share')
|
||||
->where($subSubQuery->expr()->isNotNull('parent'))
|
||||
->andWhere($subSubQuery->expr()->eq('share_type', $subSubQuery->expr()->literal(3, IQueryBuilder::PARAM_INT)));
|
||||
|
||||
$subQuery = $this->connection->getQueryBuilder();
|
||||
$subQuery->select('s1.id')
|
||||
->from($subQuery->createFunction('(' . $subSubQuery->getSQL() . ')'), 's1')
|
||||
->join(
|
||||
's1', 'share', 's2',
|
||||
$subQuery->expr()->eq('s1.parent', 's2.id')
|
||||
)
|
||||
->where($subQuery->expr()->orX(
|
||||
$subQuery->expr()->eq('s2.share_type', $subQuery->expr()->literal(1, IQueryBuilder::PARAM_INT)),
|
||||
$subQuery->expr()->eq('s2.share_type', $subQuery->expr()->literal(2, IQueryBuilder::PARAM_INT))
|
||||
))
|
||||
->andWhere($subQuery->expr()->eq('s1.item_source', 's2.item_source'));
|
||||
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->select($query->func()->count('*', 'total'))
|
||||
->from('share')
|
||||
->where($query->expr()->in('id', $query->createFunction('(' . $subQuery->getSQL() . ')')));
|
||||
|
||||
$result = $query->execute();
|
||||
$data = $result->fetch();
|
||||
$result->closeCursor();
|
||||
|
||||
return (int) $data['total'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cursor to fetch all the shares
|
||||
*
|
||||
* @return \Doctrine\DBAL\Driver\Statement
|
||||
*/
|
||||
private function getShares(): Statement {
|
||||
$subQuery = $this->connection->getQueryBuilder();
|
||||
$subQuery->select('*')
|
||||
->from('share')
|
||||
->where($subQuery->expr()->isNotNull('parent'))
|
||||
->andWhere($subQuery->expr()->eq('share_type', $subQuery->expr()->literal(3, IQueryBuilder::PARAM_INT)));
|
||||
|
||||
$query = $this->connection->getQueryBuilder();
|
||||
$query->select('s1.id', 's1.uid_owner', 's1.uid_initiator')
|
||||
->from($query->createFunction('(' . $subQuery->getSQL() . ')'), 's1')
|
||||
->join(
|
||||
's1', 'share', 's2',
|
||||
$query->expr()->eq('s1.parent', 's2.id')
|
||||
)
|
||||
->where($query->expr()->orX(
|
||||
$query->expr()->eq('s2.share_type', $query->expr()->literal(1, IQueryBuilder::PARAM_INT)),
|
||||
$query->expr()->eq('s2.share_type', $query->expr()->literal(2, IQueryBuilder::PARAM_INT))
|
||||
))
|
||||
->andWhere($query->expr()->eq('s1.item_source', 's2.item_source'));
|
||||
return $query->execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a single share
|
||||
*
|
||||
* @param array $data
|
||||
*/
|
||||
private function processShare(array $data): void {
|
||||
$id = $data['id'];
|
||||
|
||||
$this->addToNotify($data['uid_owner']);
|
||||
$this->addToNotify($data['uid_initiator']);
|
||||
|
||||
$this->deleteShare((int)$id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update list of users to notify
|
||||
*
|
||||
* @param string $uid
|
||||
*/
|
||||
private function addToNotify(string $uid): void {
|
||||
if (!isset($this->userToNotify[$uid])) {
|
||||
$this->userToNotify[$uid] = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Send all notifications
|
||||
*/
|
||||
private function sendNotification(): void {
|
||||
$time = $this->timeFactory->getDateTime();
|
||||
|
||||
$notification = $this->notificationManager->createNotification();
|
||||
$notification->setApp('core')
|
||||
->setDateTime($time)
|
||||
->setObject('repair', 'exposing_links')
|
||||
->setSubject('repair_exposing_links');
|
||||
|
||||
$users = array_keys($this->userToNotify);
|
||||
foreach ($users as $user) {
|
||||
$notification->setUser($user);
|
||||
$this->notificationManager->notify($notification);
|
||||
}
|
||||
}
|
||||
|
||||
private function repair(IOutput $output): void {
|
||||
$total = $this->getTotal();
|
||||
$output->startProgress($total);
|
||||
|
||||
$shareCursor = $this->getShares();
|
||||
while($data = $shareCursor->fetch()) {
|
||||
$this->processShare($data);
|
||||
$output->advance();
|
||||
}
|
||||
$output->finishProgress();
|
||||
$shareCursor->closeCursor();
|
||||
|
||||
// Notifiy all admins
|
||||
$adminGroup = $this->groupManager->get('admin');
|
||||
$adminUsers = $adminGroup->getUsers();
|
||||
foreach ($adminUsers as $user) {
|
||||
$this->addToNotify($user->getUID());
|
||||
}
|
||||
|
||||
$output->info('Sending notifications to admins and affected users');
|
||||
$this->sendNotification();
|
||||
}
|
||||
|
||||
public function run(IOutput $output): void {
|
||||
if ($this->shouldRun()) {
|
||||
$output->info('Removing potentially over exposing link shares');
|
||||
$this->repair($output);
|
||||
$output->info('Removed potentially over exposing link shares');
|
||||
} else {
|
||||
$output->info('No need to remove link shares.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,6 @@ namespace OC\User;
|
||||
|
||||
use OC\Cache\CappedMemoryCache;
|
||||
use OCP\IDBConnection;
|
||||
use OCP\ILogger;
|
||||
use OCP\User\Backend\ABackend;
|
||||
use OCP\User\Backend\ICheckPasswordBackend;
|
||||
use OCP\User\Backend\ICountUsersBackend;
|
||||
@@ -68,7 +67,6 @@ use OCP\User\Backend\IGetDisplayNameBackend;
|
||||
use OCP\User\Backend\IGetHomeBackend;
|
||||
use OCP\User\Backend\ISetDisplayNameBackend;
|
||||
use OCP\User\Backend\ISetPasswordBackend;
|
||||
use OCP\Util;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ interface ISecureRandom {
|
||||
const CHAR_UPPER = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
const CHAR_LOWER = 'abcdefghijklmnopqrstuvwxyz';
|
||||
const CHAR_DIGITS = '0123456789';
|
||||
const CHAR_SYMBOLS = '!\"#$%&\\\'()* +,-./:;<=>?@[\]^_`{|}~';
|
||||
const CHAR_SYMBOLS = '!\"#$%&\\\'()*+,-./:;<=>?@[\]^_`{|}~';
|
||||
|
||||
/**
|
||||
* Characters that can be used for <code>generate($length, $characters)</code>, to
|
||||
|
||||
Generated
+22
-29
@@ -1837,7 +1837,8 @@
|
||||
"commander": {
|
||||
"version": "2.17.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.17.1.tgz",
|
||||
"integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg=="
|
||||
"integrity": "sha512-wPMUt6FnH2yzG95SA6mzjQOEKUU3aLaDEmzs1ti+1E9h+CsrZghRlqEM/EJ4KscsQVG8uNN4uVreUeT8+drlgg==",
|
||||
"dev": true
|
||||
},
|
||||
"commondir": {
|
||||
"version": "1.0.1",
|
||||
@@ -3626,29 +3627,14 @@
|
||||
"integrity": "sha1-BO93hiz/K7edMPdpIJWTAiK/YPE="
|
||||
},
|
||||
"handlebars": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz",
|
||||
"integrity": "sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==",
|
||||
"version": "4.1.2",
|
||||
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz",
|
||||
"integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==",
|
||||
"requires": {
|
||||
"async": "^2.5.0",
|
||||
"neo-async": "^2.6.0",
|
||||
"optimist": "^0.6.1",
|
||||
"source-map": "^0.6.1",
|
||||
"uglify-js": "^3.1.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"async": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "http://registry.npmjs.org/async/-/async-2.6.1.tgz",
|
||||
"integrity": "sha512-fNEiL2+AZt6AlAw/29Cr0UDe4sRAHCpEHh54WMz+Bb7QfNcFw4h3loofyJpLeQs4Yx7yuqu/2dLgM5hKOs6HlQ==",
|
||||
"requires": {
|
||||
"lodash": "^4.17.10"
|
||||
}
|
||||
},
|
||||
"source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"handlebars-loader": {
|
||||
@@ -4494,9 +4480,9 @@
|
||||
}
|
||||
},
|
||||
"marked": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-0.6.1.tgz",
|
||||
"integrity": "sha512-+H0L3ibcWhAZE02SKMqmvYsErLo4EAVJxu5h3bHBBDvvjeWXtl92rGUSBYHL2++5Y+RSNgl8dYOAXcYe7lp1fA=="
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/marked/-/marked-0.6.2.tgz",
|
||||
"integrity": "sha512-LqxwVH3P/rqKX4EKGz7+c2G9r98WeM/SW34ybhgNGhUQNKtf1GmmSkJ6cDGJ/t6tiyae49qRkpyTw2B9HOrgUA=="
|
||||
},
|
||||
"md5": {
|
||||
"version": "2.2.1",
|
||||
@@ -4780,8 +4766,7 @@
|
||||
"neo-async": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.0.tgz",
|
||||
"integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==",
|
||||
"dev": true
|
||||
"integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA=="
|
||||
},
|
||||
"nextcloud-axios": {
|
||||
"version": "0.1.3",
|
||||
@@ -6809,13 +6794,21 @@
|
||||
"dev": true
|
||||
},
|
||||
"uglify-js": {
|
||||
"version": "3.4.9",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz",
|
||||
"integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==",
|
||||
"version": "3.5.7",
|
||||
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.7.tgz",
|
||||
"integrity": "sha512-GCgJx3BBuaf/QMvBBkhoHDh4SVsHCC3ILEzriPw4FgJJKCuxVBSYLRkDlmT3uhXyGWKs3VN5r0mCkBIZaHWu3w==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"commander": "~2.17.1",
|
||||
"commander": "~2.20.0",
|
||||
"source-map": "~0.6.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": {
|
||||
"version": "2.20.0",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
|
||||
"integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"underscore": {
|
||||
|
||||
+2
-2
@@ -32,14 +32,14 @@
|
||||
"css-vars-ponyfill": "^1.17.0",
|
||||
"davclient.js": "git+https://github.com/owncloud/davclient.js.git#0.1.3",
|
||||
"dompurify": "^1.0.10",
|
||||
"handlebars": "^4.1.0",
|
||||
"handlebars": "^4.1.2",
|
||||
"jcrop": "git+https://github.com/ChristophWurst/Jcrop.git#v0.9.12-npm3",
|
||||
"jquery": "2.1.4",
|
||||
"jquery-migrate": "^1.4.1",
|
||||
"jquery-ui-dist": "^1.12.1",
|
||||
"jstimezonedetect": "^1.0.6",
|
||||
"lodash": "^4.17.11",
|
||||
"marked": "^0.6.1",
|
||||
"marked": "^0.6.2",
|
||||
"moment": "^2.24.0",
|
||||
"nextcloud-axios": "^0.1.3",
|
||||
"nextcloud-password-confirmation": "^0.4.1",
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2
-2
@@ -29,10 +29,10 @@
|
||||
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
|
||||
// when updating major/minor version number.
|
||||
|
||||
$OC_Version = array(16, 0, 0, 6);
|
||||
$OC_Version = array(16, 0, 0, 9);
|
||||
|
||||
// The human readable string
|
||||
$OC_VersionString = '16.0.0 RC 1';
|
||||
$OC_VersionString = '16.0.0';
|
||||
|
||||
$OC_VersionCanBeUpgradedFrom = [
|
||||
'nextcloud' => [
|
||||
|
||||
Reference in New Issue
Block a user