diff options
26 files changed, 302 insertions, 88 deletions
diff --git a/apps/dav/appinfo/v1/caldav.php b/apps/dav/appinfo/v1/caldav.php index 301ea4b5486..bd9de775f44 100644 --- a/apps/dav/appinfo/v1/caldav.php +++ b/apps/dav/appinfo/v1/caldav.php @@ -84,7 +84,7 @@ if ($debugging) { $server->addPlugin(new \Sabre\DAV\Sync\Plugin()); $server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin()); $server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); -$server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin( \OC::$server->getMailer(), \OC::$server->getLogger())); +$server->addPlugin(new \OCA\DAV\CalDAV\Schedule\IMipPlugin( \OC::$server->getMailer(), \OC::$server->getLogger(), new \OC\AppFramework\Utility\TimeFactory())); $server->addPlugin(new ExceptionLoggerPlugin('caldav', \OC::$server->getLogger())); // And off we go! diff --git a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php index c21edb45848..8e1d7e2563d 100644 --- a/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php +++ b/apps/dav/lib/CalDAV/Schedule/IMipPlugin.php @@ -1,8 +1,10 @@ <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. + * @copyright Copyright (c) 2017, Georg Ehrke * * @author Thomas Müller <thomas.mueller@tmit.eu> + * @author Georg Ehrke <oc.list@georgehrke.com> * * @license AGPL-3.0 * @@ -21,10 +23,15 @@ */ namespace OCA\DAV\CalDAV\Schedule; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\ILogger; use OCP\Mail\IMailer; +use Sabre\VObject\Component\VCalendar; +use Sabre\VObject\DateTimeParser; use Sabre\VObject\ITip; use Sabre\CalDAV\Schedule\IMipPlugin as SabreIMipPlugin; +use Sabre\VObject\Recur\EventIterator; + /** * iMIP handler. * @@ -47,15 +54,23 @@ class IMipPlugin extends SabreIMipPlugin { /** @var ILogger */ private $logger; + /** @var ITimeFactory */ + private $timeFactory; + + const MAX_DATE = '2038-01-01'; + /** * Creates the email handler. * * @param IMailer $mailer + * @param ILogger $logger + * @param ITimeFactory $timeFactory */ - function __construct(IMailer $mailer, ILogger $logger) { + function __construct(IMailer $mailer, ILogger $logger, ITimeFactory $timeFactory) { parent::__construct(''); $this->mailer = $mailer; $this->logger = $logger; + $this->timeFactory = $timeFactory; } /** @@ -85,6 +100,11 @@ class IMipPlugin extends SabreIMipPlugin { return; } + // don't send out mails for events that already took place + if ($this->isEventInThePast($iTipMessage->message)) { + return; + } + $sender = substr($iTipMessage->sender, 7); $recipient = substr($iTipMessage->recipient, 7); @@ -125,4 +145,49 @@ class IMipPlugin extends SabreIMipPlugin { } } + /** + * check if event took place in the past already + * @param VCalendar $vObject + * @return bool + */ + private function isEventInThePast(VCalendar $vObject) { + $component = $vObject->VEVENT; + + $firstOccurrence = $component->DTSTART->getDateTime()->getTimeStamp(); + // Finding the last occurrence is a bit harder + if (!isset($component->RRULE)) { + if (isset($component->DTEND)) { + $lastOccurrence = $component->DTEND->getDateTime()->getTimeStamp(); + } elseif (isset($component->DURATION)) { + $endDate = clone $component->DTSTART->getDateTime(); + // $component->DTEND->getDateTime() returns DateTimeImmutable + $endDate = $endDate->add(DateTimeParser::parse($component->DURATION->getValue())); + $lastOccurrence = $endDate->getTimeStamp(); + } elseif (!$component->DTSTART->hasTime()) { + $endDate = clone $component->DTSTART->getDateTime(); + // $component->DTSTART->getDateTime() returns DateTimeImmutable + $endDate = $endDate->modify('+1 day'); + $lastOccurrence = $endDate->getTimeStamp(); + } else { + $lastOccurrence = $firstOccurrence; + } + } else { + $it = new EventIterator($vObject, (string)$component->UID); + $maxDate = new \DateTime(self::MAX_DATE); + if ($it->isInfinite()) { + $lastOccurrence = $maxDate->getTimestamp(); + } else { + $end = $it->getDtEnd(); + while($it->valid() && $end < $maxDate) { + $end = $it->getDtEnd(); + $it->next(); + + } + $lastOccurrence = $end->getTimestamp(); + } + } + + $currentTime = $this->timeFactory->getTime(); + return $lastOccurrence < $currentTime; + } } diff --git a/apps/dav/lib/Server.php b/apps/dav/lib/Server.php index b93f3e6390a..ac0abc8b4eb 100644 --- a/apps/dav/lib/Server.php +++ b/apps/dav/lib/Server.php @@ -28,6 +28,7 @@ */ namespace OCA\DAV; +use OC\AppFramework\Utility\TimeFactory; use OCA\DAV\CalDAV\Schedule\IMipPlugin; use OCA\DAV\CardDAV\ImageExportPlugin; use OCA\DAV\CardDAV\PhotoCache; @@ -74,6 +75,7 @@ class Server { $logger = \OC::$server->getLogger(); $mailer = \OC::$server->getMailer(); $dispatcher = \OC::$server->getEventDispatcher(); + $timezone = new TimeFactory(); $root = new RootCollection(); $this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root)); @@ -135,7 +137,7 @@ class Server { $this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin()); $this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin()); $this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); - $this->server->addPlugin(new IMipPlugin($mailer, $logger)); + $this->server->addPlugin(new IMipPlugin($mailer, $logger, $timezone)); $this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin()); $this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin()); $this->server->addPlugin(new DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest())); diff --git a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php index 2b9d10c9e81..56eb00406da 100644 --- a/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php +++ b/apps/dav/tests/unit/CalDAV/Schedule/IMipPluginTest.php @@ -1,9 +1,11 @@ <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. + * @copyright Copyright (c) 2017, Georg Ehrke * * @author Joas Schilling <coding@schilljs.com> * @author Thomas Müller <thomas.mueller@tmit.eu> + * @author Georg Ehrke <oc.list@georgehrke.com> * * @license AGPL-3.0 * @@ -25,6 +27,7 @@ namespace OCA\DAV\Tests\unit\CalDAV\Schedule; use OC\Mail\Mailer; use OCA\DAV\CalDAV\Schedule\IMipPlugin; +use OCP\AppFramework\Utility\ITimeFactory; use OCP\ILogger; use Sabre\VObject\Component\VCalendar; use Sabre\VObject\ITip\Message; @@ -40,8 +43,10 @@ class IMipPluginTest extends TestCase { $mailer->expects($this->once())->method('send'); /** @var ILogger | \PHPUnit_Framework_MockObject_MockObject $logger */ $logger = $this->getMockBuilder('OC\Log')->disableOriginalConstructor()->getMock(); + $timeFactory = $this->getMockBuilder(ITimeFactory::class)->disableOriginalConstructor()->getMock(); + $timeFactory->method('getTime')->willReturn(1); - $plugin = new IMipPlugin($mailer, $logger); + $plugin = new IMipPlugin($mailer, $logger, $timeFactory); $message = new Message(); $message->method = 'REQUEST'; $message->message = new VCalendar(); @@ -49,6 +54,7 @@ class IMipPluginTest extends TestCase { 'UID' => $message->uid, 'SEQUENCE' => $message->sequence, 'SUMMARY' => 'Fellowship meeting', + 'DTSTART' => new \DateTime('2017-01-01 00:00:00') // 1483228800 ]); $message->sender = 'mailto:gandalf@wiz.ard'; $message->recipient = 'mailto:frodo@hobb.it'; @@ -69,8 +75,10 @@ class IMipPluginTest extends TestCase { $mailer->method('send')->willThrowException(new \Exception()); /** @var ILogger | \PHPUnit_Framework_MockObject_MockObject $logger */ $logger = $this->getMockBuilder('OC\Log')->disableOriginalConstructor()->getMock(); + $timeFactory = $this->getMockBuilder(ITimeFactory::class)->disableOriginalConstructor()->getMock(); + $timeFactory->method('getTime')->willReturn(1); - $plugin = new IMipPlugin($mailer, $logger); + $plugin = new IMipPlugin($mailer, $logger, $timeFactory); $message = new Message(); $message->method = 'REQUEST'; $message->message = new VCalendar(); @@ -78,6 +86,7 @@ class IMipPluginTest extends TestCase { 'UID' => $message->uid, 'SEQUENCE' => $message->sequence, 'SUMMARY' => 'Fellowship meeting', + 'DTSTART' => new \DateTime('2017-01-01 00:00:00') // 1483228800 ]); $message->sender = 'mailto:gandalf@wiz.ard'; $message->recipient = 'mailto:frodo@hobb.it'; @@ -90,4 +99,57 @@ class IMipPluginTest extends TestCase { $this->assertEquals('text/calendar; charset=UTF-8; method=REQUEST', $mailMessage->getSwiftMessage()->getContentType()); } + /** + * @dataProvider dataNoMessageSendForPastEvents + */ + public function testNoMessageSendForPastEvents($veventParams, $expectsMail) { + $mailMessage = new \OC\Mail\Message(new \Swift_Message()); + /** @var Mailer | \PHPUnit_Framework_MockObject_MockObject $mailer */ + $mailer = $this->getMockBuilder('OC\Mail\Mailer')->disableOriginalConstructor()->getMock(); + $mailer->method('createMessage')->willReturn($mailMessage); + if ($expectsMail) { + $mailer->expects($this->once())->method('send'); + } else { + $mailer->expects($this->never())->method('send'); + } + /** @var ILogger | \PHPUnit_Framework_MockObject_MockObject $logger */ + $logger = $this->getMockBuilder('OC\Log')->disableOriginalConstructor()->getMock(); + $timeFactory = $this->getMockBuilder(ITimeFactory::class)->disableOriginalConstructor()->getMock(); + $timeFactory->method('getTime')->willReturn(1496912528); + + $plugin = new IMipPlugin($mailer, $logger, $timeFactory); + $message = new Message(); + $message->method = 'REQUEST'; + $message->message = new VCalendar(); + $message->message->add('VEVENT', array_merge([ + 'UID' => 'uid1337', + 'SEQUENCE' => 42, + 'SUMMARY' => 'Fellowship meeting', + ], $veventParams)); + $message->sender = 'mailto:gandalf@wiz.ard'; + $message->recipient = 'mailto:frodo@hobb.it'; + + $plugin->schedule($message); + + if ($expectsMail) { + $this->assertEquals('1.1', $message->getScheduleStatus()); + } else { + $this->assertEquals(false, $message->getScheduleStatus()); + } + } + + public function dataNoMessageSendForPastEvents() { + return [ + [['DTSTART' => new \DateTime('2017-01-01 00:00:00')], false], + [['DTSTART' => new \DateTime('2017-01-01 00:00:00'), 'DTEND' => new \DateTime('2017-01-01 00:00:00')], false], + [['DTSTART' => new \DateTime('2017-01-01 00:00:00'), 'DTEND' => new \DateTime('2017-12-31 00:00:00')], true], + [['DTSTART' => new \DateTime('2017-01-01 00:00:00'), 'DURATION' => 'P1D'], false], + [['DTSTART' => new \DateTime('2017-01-01 00:00:00'), 'DURATION' => 'P52W'], true], + [['DTSTART' => new \DateTime('2017-01-01 00:00:00'), 'DTEND' => new \DateTime('2017-01-01 00:00:00'), 'RRULE' => 'FREQ=WEEKLY'], true], + [['DTSTART' => new \DateTime('2017-01-01 00:00:00'), 'DTEND' => new \DateTime('2017-01-01 00:00:00'), 'RRULE' => 'FREQ=WEEKLY;COUNT=3'], false], + [['DTSTART' => new \DateTime('2017-01-01 00:00:00'), 'DTEND' => new \DateTime('2017-01-01 00:00:00'), 'RRULE' => 'FREQ=WEEKLY;UNTIL=20170301T000000Z'], false], + [['DTSTART' => new \DateTime('2017-01-01 00:00:00'), 'DTEND' => new \DateTime('2017-01-01 00:00:00'), 'RRULE' => 'FREQ=WEEKLY;COUNT=33'], true], + [['DTSTART' => new \DateTime('2017-01-01 00:00:00'), 'DTEND' => new \DateTime('2017-01-01 00:00:00'), 'RRULE' => 'FREQ=WEEKLY;UNTIL=20171001T000000Z'], true], + ]; + } } diff --git a/apps/files/l10n/da.js b/apps/files/l10n/da.js index f7d90b6af9b..c22801a26f6 100644 --- a/apps/files/l10n/da.js +++ b/apps/files/l10n/da.js @@ -16,6 +16,8 @@ OC.L10N.register( "Not enough free space, you are uploading {size1} but only {size2} is left" : "Der er ikke tilstrækkeligt friplads. Du uplaoder {size1} men der er kun {size2} tilbage", "Target folder \"{dir}\" does not exist any more" : "Destinations mappen \"{dir}\" eksistere ikke længere", "Not enough free space" : "Ikke nok fri plads", + "Uploading …" : "Uploader...", + "…" : "...", "{loadedSize} of {totalSize} ({bitrate})" : "{loadedSize} af {totalSize} ({bitrate})", "Actions" : "Handlinger", "Download" : "Hent", @@ -100,7 +102,9 @@ OC.L10N.register( "A file has been added to or removed from your <strong>favorites</strong>" : "En fil er blevet tilføjet eller fjernet fra dine <strong>favoritter</strong>", "A file or folder has been <strong>changed</strong> or <strong>renamed</strong>" : "En fil eller mappe er blevet <strong>ændret</strong> eller <strong>omdøbt</strong>", "A new file or folder has been <strong>created</strong>" : "En ny fil eller mapper er blevet <strong>oprettet</strong>", + "A file or folder has been <strong>deleted</strong>" : "En fil eller mappe er blevet <strong>slettet</strong>", "Limit notifications about creation and changes to your <strong>favorite files</strong> <em>(Stream only)</em>" : "Begræns noter om oprettelse og ændringer af dine <strong>favorit filer</strong> <em>(Kun streaming)</em>", + "A file or folder has been <strong>restored</strong>" : "En fil eller mappe er blevet <strong>gendannet</strong>", "Unlimited" : "Ubegrænset", "Upload (max. %s)" : "Upload (max. %s)", "File handling" : "Filhåndtering", @@ -115,6 +119,7 @@ OC.L10N.register( "Show hidden files" : "Vis skjulte filer", "WebDAV" : "WebDAV", "Use this address to <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">access your Files via WebDAV</a>" : "Brug denne adresse til at <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">tilgå dine filer via WebDAV</a>", + "Uploading @" : "Uploader @", "No files in here" : "Her er ingen filer", "Upload some content or sync with your devices!" : "Overfør indhold eller synkronisér med dine enheder!", "No entries found in this folder" : "Der blev ikke fundet poster i denne mappe", diff --git a/apps/files/l10n/da.json b/apps/files/l10n/da.json index dc40721380e..9f279f3d095 100644 --- a/apps/files/l10n/da.json +++ b/apps/files/l10n/da.json @@ -14,6 +14,8 @@ "Not enough free space, you are uploading {size1} but only {size2} is left" : "Der er ikke tilstrækkeligt friplads. Du uplaoder {size1} men der er kun {size2} tilbage", "Target folder \"{dir}\" does not exist any more" : "Destinations mappen \"{dir}\" eksistere ikke længere", "Not enough free space" : "Ikke nok fri plads", + "Uploading …" : "Uploader...", + "…" : "...", "{loadedSize} of {totalSize} ({bitrate})" : "{loadedSize} af {totalSize} ({bitrate})", "Actions" : "Handlinger", "Download" : "Hent", @@ -98,7 +100,9 @@ "A file has been added to or removed from your <strong>favorites</strong>" : "En fil er blevet tilføjet eller fjernet fra dine <strong>favoritter</strong>", "A file or folder has been <strong>changed</strong> or <strong>renamed</strong>" : "En fil eller mappe er blevet <strong>ændret</strong> eller <strong>omdøbt</strong>", "A new file or folder has been <strong>created</strong>" : "En ny fil eller mapper er blevet <strong>oprettet</strong>", + "A file or folder has been <strong>deleted</strong>" : "En fil eller mappe er blevet <strong>slettet</strong>", "Limit notifications about creation and changes to your <strong>favorite files</strong> <em>(Stream only)</em>" : "Begræns noter om oprettelse og ændringer af dine <strong>favorit filer</strong> <em>(Kun streaming)</em>", + "A file or folder has been <strong>restored</strong>" : "En fil eller mappe er blevet <strong>gendannet</strong>", "Unlimited" : "Ubegrænset", "Upload (max. %s)" : "Upload (max. %s)", "File handling" : "Filhåndtering", @@ -113,6 +117,7 @@ "Show hidden files" : "Vis skjulte filer", "WebDAV" : "WebDAV", "Use this address to <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">access your Files via WebDAV</a>" : "Brug denne adresse til at <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">tilgå dine filer via WebDAV</a>", + "Uploading @" : "Uploader @", "No files in here" : "Her er ingen filer", "Upload some content or sync with your devices!" : "Overfør indhold eller synkronisér med dine enheder!", "No entries found in this folder" : "Der blev ikke fundet poster i denne mappe", diff --git a/apps/files/l10n/lt_LT.js b/apps/files/l10n/lt_LT.js index 1eb213481c1..309f508aa20 100644 --- a/apps/files/l10n/lt_LT.js +++ b/apps/files/l10n/lt_LT.js @@ -119,6 +119,7 @@ OC.L10N.register( "Show hidden files" : "Rodyti paslėptus failus", "WebDAV" : "WebDAV", "Use this address to <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">access your Files via WebDAV</a>" : "Naudokite šį adresą <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\"> norėdami pasiekti failus per WebDAV</a>", + "Uploading @" : "Įkeliama @", "No files in here" : "Čia nėra failų", "Upload some content or sync with your devices!" : "Įkelkite kokį nors turinį, arba sinchronizuokite su savo įrenginiais!", "No entries found in this folder" : "Nerasta įrašų šiame aplanke", diff --git a/apps/files/l10n/lt_LT.json b/apps/files/l10n/lt_LT.json index c3eb472a141..fe6ae055f63 100644 --- a/apps/files/l10n/lt_LT.json +++ b/apps/files/l10n/lt_LT.json @@ -117,6 +117,7 @@ "Show hidden files" : "Rodyti paslėptus failus", "WebDAV" : "WebDAV", "Use this address to <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\">access your Files via WebDAV</a>" : "Naudokite šį adresą <a href=\"%s\" target=\"_blank\" rel=\"noreferrer\"> norėdami pasiekti failus per WebDAV</a>", + "Uploading @" : "Įkeliama @", "No files in here" : "Čia nėra failų", "Upload some content or sync with your devices!" : "Įkelkite kokį nors turinį, arba sinchronizuokite su savo įrenginiais!", "No entries found in this folder" : "Nerasta įrašų šiame aplanke", diff --git a/apps/files_external/tests/Service/StoragesServiceTest.php b/apps/files_external/tests/Service/StoragesServiceTest.php index 2776f24d5ab..056a03d24c8 100644 --- a/apps/files_external/tests/Service/StoragesServiceTest.php +++ b/apps/files_external/tests/Service/StoragesServiceTest.php @@ -22,10 +22,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ + namespace OCA\Files_External\Tests\Service; use \OC\Files\Filesystem; +use OCA\Files_External\Lib\Auth\InvalidAuth; +use OCA\Files_External\Lib\Backend\InvalidBackend; use OCA\Files_External\NotFoundException; use OCA\Files_External\Lib\StorageConfig; use OCA\Files_External\Service\BackendService; @@ -368,28 +371,24 @@ abstract class StoragesServiceTest extends \Test\TestCase { $this->assertEquals($priority, $storage->getPriority()); } - /** - * @expectedException \InvalidArgumentException - */ public function testCreateStorageInvalidClass() { - $this->service->createStorage( + $storage = $this->service->createStorage( 'mount', 'identifier:\OC\Not\A\Backend', 'identifier:\Auth\Mechanism', [] ); + $this->assertInstanceOf(InvalidBackend::class, $storage->getBackend()); } - /** - * @expectedException \InvalidArgumentException - */ public function testCreateStorageInvalidAuthMechanismClass() { - $this->service->createStorage( + $storage = $this->service->createStorage( 'mount', 'identifier:\OCA\Files_External\Lib\Backend\SMB', 'identifier:\Not\An\Auth\Mechanism', [] ); + $this->assertInstanceOf(InvalidAuth::class, $storage->getAuthMechanism()); } public function testGetStoragesBackendNotVisible() { diff --git a/apps/theming/l10n/lt_LT.js b/apps/theming/l10n/lt_LT.js index 7f645a20852..dd895804418 100644 --- a/apps/theming/l10n/lt_LT.js +++ b/apps/theming/l10n/lt_LT.js @@ -3,6 +3,7 @@ OC.L10N.register( { "Loading preview…" : "Įkeliama peržiūra…", "Saved" : "Įrašyta", + "Admin" : "Administravimas", "a safe home for all your data" : "saugūs namai visiems jūsų duomenims", "The given name is too long" : "Nurodytas pavadinimas yra per ilgas", "The given web address is too long" : "Nurodytas adresas yra per ilgas", @@ -11,7 +12,9 @@ OC.L10N.register( "No file uploaded" : "Neįkeltas joks failas", "Unsupported image type" : "Nepalaikomas paveikslo tipas", "You are already using a custom theme" : "Jūs jau naudojate tinkintą temą", + "Theming" : "Tema", "Name" : "Pavadinimas", + "Reset to default" : "Atstatyti į numatytąją", "Web address" : "Saityno adresas", "Web address https://…" : "Saityno adresas https://…", "Slogan" : "Šūkis", @@ -20,6 +23,8 @@ OC.L10N.register( "Upload new logo" : "Įkelti naują logotipą", "Login image" : "Prisijungimo paveikslas", "Upload new login background" : "Įkelti naują prisijungimo foną", - "Remove background image" : "Šalinti foninį paveikslą" + "Remove background image" : "Šalinti foninį paveikslą", + "reset to default" : "atstatyta į numatytąją", + "Log in image" : "Prisijungimo vaizdas" }, "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);"); diff --git a/apps/theming/l10n/lt_LT.json b/apps/theming/l10n/lt_LT.json index d9b0eee99f1..74a192b259c 100644 --- a/apps/theming/l10n/lt_LT.json +++ b/apps/theming/l10n/lt_LT.json @@ -1,6 +1,7 @@ { "translations": { "Loading preview…" : "Įkeliama peržiūra…", "Saved" : "Įrašyta", + "Admin" : "Administravimas", "a safe home for all your data" : "saugūs namai visiems jūsų duomenims", "The given name is too long" : "Nurodytas pavadinimas yra per ilgas", "The given web address is too long" : "Nurodytas adresas yra per ilgas", @@ -9,7 +10,9 @@ "No file uploaded" : "Neįkeltas joks failas", "Unsupported image type" : "Nepalaikomas paveikslo tipas", "You are already using a custom theme" : "Jūs jau naudojate tinkintą temą", + "Theming" : "Tema", "Name" : "Pavadinimas", + "Reset to default" : "Atstatyti į numatytąją", "Web address" : "Saityno adresas", "Web address https://…" : "Saityno adresas https://…", "Slogan" : "Šūkis", @@ -18,6 +21,8 @@ "Upload new logo" : "Įkelti naują logotipą", "Login image" : "Prisijungimo paveikslas", "Upload new login background" : "Įkelti naują prisijungimo foną", - "Remove background image" : "Šalinti foninį paveikslą" + "Remove background image" : "Šalinti foninį paveikslą", + "reset to default" : "atstatyta į numatytąją", + "Log in image" : "Prisijungimo vaizdas" },"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2);" }
\ No newline at end of file diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php index bec81a89d53..5767c9e1c62 100644 --- a/core/Controller/ClientFlowLoginController.php +++ b/core/Controller/ClientFlowLoginController.php @@ -193,6 +193,7 @@ class ClientFlowLoginController extends Controller { 'urlGenerator' => $this->urlGenerator, 'stateToken' => $stateToken, 'serverHost' => $this->request->getServerHost(), + 'oauthState' => $this->session->get('oauth.state'), ], 'guest' ); diff --git a/core/Controller/LoginController.php b/core/Controller/LoginController.php index 47c14cbeaf4..462b9091d4f 100644 --- a/core/Controller/LoginController.php +++ b/core/Controller/LoginController.php @@ -184,12 +184,12 @@ class LoginController extends Controller { } // OpenGraph Support: http://ogp.me/ - Util::addHeader('meta', ['property' => "og:title", 'content' => Util::sanitizeHTML($this->defaults->getName())]); - Util::addHeader('meta', ['property' => "og:description", 'content' => Util::sanitizeHTML($this->defaults->getSlogan())]); - Util::addHeader('meta', ['property' => "og:site_name", 'content' => Util::sanitizeHTML($this->defaults->getName())]); - Util::addHeader('meta', ['property' => "og:url", 'content' => $this->urlGenerator->getAbsoluteURL('')]); - Util::addHeader('meta', ['property' => "og:type", 'content' => "website"]); - Util::addHeader('meta', ['property' => "og:image", 'content' => $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core','favicon-touch.png'))]); + Util::addHeader('meta', ['property' => 'og:title', 'content' => Util::sanitizeHTML($this->defaults->getName())]); + Util::addHeader('meta', ['property' => 'og:description', 'content' => Util::sanitizeHTML($this->defaults->getSlogan())]); + Util::addHeader('meta', ['property' => 'og:site_name', 'content' => Util::sanitizeHTML($this->defaults->getName())]); + Util::addHeader('meta', ['property' => 'og:url', 'content' => $this->urlGenerator->getAbsoluteURL('/')]); + Util::addHeader('meta', ['property' => 'og:type', 'content' => 'website']); + Util::addHeader('meta', ['property' => 'og:image', 'content' => $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('core','favicon-touch.png'))]); return new TemplateResponse( $this->appName, 'login', $parameters, 'guest' diff --git a/lib/private/Authentication/TwoFactorAuth/Manager.php b/lib/private/Authentication/TwoFactorAuth/Manager.php index 88ca4ba6084..fd0d5914d02 100644 --- a/lib/private/Authentication/TwoFactorAuth/Manager.php +++ b/lib/private/Authentication/TwoFactorAuth/Manager.php @@ -293,7 +293,6 @@ class Manager { return false; } } catch (InvalidTokenException $e) { - return true; } } diff --git a/lib/private/Group/Backend.php b/lib/private/Group/Backend.php index 1e8d62f5e42..001d8d9da66 100644 --- a/lib/private/Group/Backend.php +++ b/lib/private/Group/Backend.php @@ -38,6 +38,7 @@ abstract class Backend implements \OCP\GroupInterface { self::REMOVE_FROM_GOUP => 'removeFromGroup', self::COUNT_USERS => 'countUsersInGroup', self::GROUP_DETAILS => 'getGroupDetails', + self::IS_ADMIN => 'isAdmin', ]; /** diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index 6d4f5a091c6..15d83380acf 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -288,6 +288,11 @@ class Manager extends PublicEmitter implements IGroupManager { * @return bool if admin */ public function isAdmin($userId) { + foreach ($this->backends as $backend) { + if ($backend->implementsActions(\OC\Group\Backend::IS_ADMIN) && $backend->isAdmin($userId)) { + return true; + } + } return $this->isInGroup($userId, 'admin'); } diff --git a/lib/private/Template/CSSResourceLocator.php b/lib/private/Template/CSSResourceLocator.php index 32dabb48c0d..1b4050e4ae0 100644 --- a/lib/private/Template/CSSResourceLocator.php +++ b/lib/private/Template/CSSResourceLocator.php @@ -117,38 +117,18 @@ class CSSResourceLocator extends ResourceLocator { parent::append($root, $file, $webRoot, $throw); } else { if (!$webRoot) { - $tmpRoot = realpath($root); - /* - * traverse the potential web roots upwards in the path - * - * example: - * - root: /srv/www/apps/myapp - * - available mappings: ['/srv/www'] - * - * First we check if a mapping for /srv/www/apps/myapp is available, - * then /srv/www/apps, /srv/www/apps, /srv/www, ... until we find a - * valid web root - */ - do { - if (isset($this->mapping[$tmpRoot])) { - $webRoot = $this->mapping[$tmpRoot]; - break; - } - - if ($tmpRoot === '/') { - $webRoot = ''; - $this->logger->error('ResourceLocator can not find a web root (root: {root}, file: {file}, webRoot: {webRoot}, throw: {throw})', [ - 'app' => 'lib', - 'root' => $root, - 'file' => $file, - 'webRoot' => $webRoot, - 'throw' => $throw ? 'true' : 'false' - ]); - break; - } - $tmpRoot = dirname($tmpRoot); - } while(true); - + $webRoot = $this->findWebRoot($root); + + if (!$webRoot) { + $webRoot = ''; + $this->logger->error('ResourceLocator can not find a web root (root: {root}, file: {file}, webRoot: {webRoot}, throw: {throw})', [ + 'app' => 'lib', + 'root' => $root, + 'file' => $file, + 'webRoot' => $webRoot, + 'throw' => $throw ? 'true' : 'false' + ]); + } } if ($throw && $tmpRoot === '/') { diff --git a/lib/private/Template/ResourceLocator.php b/lib/private/Template/ResourceLocator.php index f721906e12b..2127161f28c 100755 --- a/lib/private/Template/ResourceLocator.php +++ b/lib/private/Template/ResourceLocator.php @@ -107,6 +107,50 @@ abstract class ResourceLocator { } /** + * Attempt to find the webRoot + * + * traverse the potential web roots upwards in the path + * + * example: + * - root: /srv/www/apps/myapp + * - available mappings: ['/srv/www'] + * + * First we check if a mapping for /srv/www/apps/myapp is available, + * then /srv/www/apps, /srv/www/apps, /srv/www, ... until we find a + * valid web root + * + * @param string $root + * @return string|null The web root or null on failure + */ + protected function findWebRoot($root) { + $webRoot = null; + $tmpRoot = $root; + + while ($webRoot === null) { + if (isset($this->mapping[$tmpRoot])) { + $webRoot = $this->mapping[$tmpRoot]; + break; + } + + if ($tmpRoot === '/') { + break; + } + + $tmpRoot = dirname($tmpRoot); + } + + if (!$webRoot) { + $realpath = realpath($root); + + if ($realpath && ($realpath !== $root)) { + return $this->findWebRoot($realpath); + } + } + + return $webRoot; + } + + /** * append the $file resource at $root * * @param string $root path to check @@ -125,38 +169,18 @@ abstract class ResourceLocator { } if (!$webRoot) { - $tmpRoot = realpath($root); - /* - * traverse the potential web roots upwards in the path - * - * example: - * - root: /srv/www/apps/myapp - * - available mappings: ['/srv/www'] - * - * First we check if a mapping for /srv/www/apps/myapp is available, - * then /srv/www/apps, /srv/www/apps, /srv/www, ... until we find a - * valid web root - */ - do { - if (isset($this->mapping[$tmpRoot])) { - $webRoot = $this->mapping[$tmpRoot]; - break; - } - - if ($tmpRoot === '/') { - $webRoot = ''; - $this->logger->error('ResourceLocator can not find a web root (root: {root}, file: {file}, webRoot: {webRoot}, throw: {throw})', [ - 'app' => 'lib', - 'root' => $root, - 'file' => $file, - 'webRoot' => $webRoot, - 'throw' => $throw ? 'true' : 'false' - ]); - break; - } - $tmpRoot = dirname($tmpRoot); - } while(true); - + $webRoot = $this->findWebRoot($root); + + if (!$webRoot) { + $webRoot = ''; + $this->logger->error('ResourceLocator can not find a web root (root: {root}, file: {file}, webRoot: {webRoot}, throw: {throw})', [ + 'app' => 'lib', + 'root' => $root, + 'file' => $file, + 'webRoot' => $webRoot, + 'throw' => $throw ? 'true' : 'false' + ]); + } } $this->resources[] = array($root, $webRoot, $file); diff --git a/lib/public/GroupInterface.php b/lib/public/GroupInterface.php index 97837e50b16..f6ef237a333 100644 --- a/lib/public/GroupInterface.php +++ b/lib/public/GroupInterface.php @@ -51,6 +51,10 @@ interface GroupInterface { //OBSOLETE const GET_DISPLAYNAME = 0x00010000; const COUNT_USERS = 0x00100000; const GROUP_DETAILS = 0x01000000; + /** + * @since 13.0.0 + */ + const IS_ADMIN = 0x10000000; /** * Check if backend implements actions diff --git a/settings/l10n/lt_LT.js b/settings/l10n/lt_LT.js index fd94a0a9d38..32c0af4116f 100644 --- a/settings/l10n/lt_LT.js +++ b/settings/l10n/lt_LT.js @@ -5,9 +5,15 @@ OC.L10N.register( "You changed your password" : "Jūs pakeitėte savo slaptažodį", "Your password was reset by an administrator" : "Administratorius atstatė jūsų slaptažodį", "{actor} changed your email address" : "{actor} pakeitė jūsų el. pašto adresą", + "You changed your email address" : "Jūs pakeitėte savo elektroninio pašto adresą", + "Your email address was changed by an administrator" : "Administratorius pakeitė jūsų elektroninio pašto adresą", "Security" : "Saugumas", + "You successfully logged in using two-factor authentication (%1$s)" : "Jūs sėkmingai prisijungėte, panaudodami dviejų faktorių tapatybės nustatymą (%1$s)", + "A login attempt using two-factor authentication failed (%1$s)" : "Nepavyko prisijungti, panaudojant dviejų faktorių tapatybės nustatymą (%1$s)", "Your <strong>password</strong> or <strong>email</strong> was modified" : "Jūsų <strong>slaptažodis</strong> ar <strong>el. paštas</strong> buvo pakeisti", "Your apps" : "Jūsų programėlės", + "Enabled apps" : "Įjungtos programėlės", + "Disabled apps" : "Išjungtos programėlės", "Wrong password" : "Neteisingas slaptažodis", "Saved" : "Įrašyta", "No user supplied" : "Nepateiktas naudotojas", @@ -15,22 +21,32 @@ OC.L10N.register( "Authentication error" : "Tapatybės nustatymo klaida", "Wrong admin recovery password. Please check the password and try again." : "Netinkamas administratoriaus atkūrimo slaptažodis. Prašome pasitikrinti ir bandyti vėl.", "A problem occurred, please check your log files (Error: %s)" : "Atsirado problema, prašome patikrinti savo žurnalo failus (Klaida: %s)", + "Migration Completed" : "Migracija baigta", "Group already exists." : "Grupė jau yra.", "Unable to add group." : "Nepavyko pridėti grupės.", "Unable to delete group." : "Nepavyko ištrinti grupės.", "Invalid SMTP password." : "Neteisingas SMTP slaptažodis.", + "Email setting test" : "El. pašto nustatymo testas", + "Email could not be sent. Check your mail server log" : "El. laiškas nebuvo išsiųstas. Peržiūrėkite savo pašto serverio žurnalą.", + "A problem occurred while sending the email. Please revise your settings. (Error: %s)" : "Įvyko klaida išsiunčiant laišką. Prašome peržiūrėkite savo nustatymus. (Klaida: %s)", + "You need to set your user email before being able to send test emails." : "Jūs turite nurodyti elektroninio pašto adresą, kad galėtumėte siųsti testinius el. laiškus.", "Invalid mail address" : "Neteisingas pašto adresas", + "No valid group selected" : "Pasirinkta neteisinga grupė", "A user with that name already exists." : "Toks naudotojas jau yra.", + "To send a password link to the user an email address is required." : "Norint persiųsti slaptažodžio nuorodą, būtinas el. pašto adresas.", "Unable to create user." : "Nepavyko sukurti naudotojo.", "Unable to delete user." : "Nepavyko ištrinti naudotojo.", "Error while enabling user." : "Klaida įjungiant naudotoją.", "Error while disabling user." : "Klaida išjungiant naudotoją.", "Settings saved" : "Nustatymai įrašyti", "Unable to change full name" : "Nepavyko pakeisti pilno vardo", + "Unable to change email address" : "Nepavyko pakeisti el. pašto adresą", "Your full name has been changed." : "Pilnas vardas pakeistas.", + "Forbidden" : "Uždrausta", "Invalid user" : "Neteisingas naudotojas", "Unable to change mail address" : "Nepavyko pakeisti el. pašto adresą", "Email saved" : "El. paštas įrašytas", + "%1$s changed your password on %2$s." : "%1$s pakeitė jūsų slaptažodį %2$s", "The new email address is %s" : "Naujasis el. pašto adresas yra %s", "Your username is: %s" : "Jūsų naudotojo vardas yra: %s", "Your %s account was created" : "Jūsų paskyra %s sukurta", diff --git a/settings/l10n/lt_LT.json b/settings/l10n/lt_LT.json index bb988e23139..7ac504f3f40 100644 --- a/settings/l10n/lt_LT.json +++ b/settings/l10n/lt_LT.json @@ -3,9 +3,15 @@ "You changed your password" : "Jūs pakeitėte savo slaptažodį", "Your password was reset by an administrator" : "Administratorius atstatė jūsų slaptažodį", "{actor} changed your email address" : "{actor} pakeitė jūsų el. pašto adresą", + "You changed your email address" : "Jūs pakeitėte savo elektroninio pašto adresą", + "Your email address was changed by an administrator" : "Administratorius pakeitė jūsų elektroninio pašto adresą", "Security" : "Saugumas", + "You successfully logged in using two-factor authentication (%1$s)" : "Jūs sėkmingai prisijungėte, panaudodami dviejų faktorių tapatybės nustatymą (%1$s)", + "A login attempt using two-factor authentication failed (%1$s)" : "Nepavyko prisijungti, panaudojant dviejų faktorių tapatybės nustatymą (%1$s)", "Your <strong>password</strong> or <strong>email</strong> was modified" : "Jūsų <strong>slaptažodis</strong> ar <strong>el. paštas</strong> buvo pakeisti", "Your apps" : "Jūsų programėlės", + "Enabled apps" : "Įjungtos programėlės", + "Disabled apps" : "Išjungtos programėlės", "Wrong password" : "Neteisingas slaptažodis", "Saved" : "Įrašyta", "No user supplied" : "Nepateiktas naudotojas", @@ -13,22 +19,32 @@ "Authentication error" : "Tapatybės nustatymo klaida", "Wrong admin recovery password. Please check the password and try again." : "Netinkamas administratoriaus atkūrimo slaptažodis. Prašome pasitikrinti ir bandyti vėl.", "A problem occurred, please check your log files (Error: %s)" : "Atsirado problema, prašome patikrinti savo žurnalo failus (Klaida: %s)", + "Migration Completed" : "Migracija baigta", "Group already exists." : "Grupė jau yra.", "Unable to add group." : "Nepavyko pridėti grupės.", "Unable to delete group." : "Nepavyko ištrinti grupės.", "Invalid SMTP password." : "Neteisingas SMTP slaptažodis.", + "Email setting test" : "El. pašto nustatymo testas", + "Email could not be sent. Check your mail server log" : "El. laiškas nebuvo išsiųstas. Peržiūrėkite savo pašto serverio žurnalą.", + "A problem occurred while sending the email. Please revise your settings. (Error: %s)" : "Įvyko klaida išsiunčiant laišką. Prašome peržiūrėkite savo nustatymus. (Klaida: %s)", + "You need to set your user email before being able to send test emails." : "Jūs turite nurodyti elektroninio pašto adresą, kad galėtumėte siųsti testinius el. laiškus.", "Invalid mail address" : "Neteisingas pašto adresas", + "No valid group selected" : "Pasirinkta neteisinga grupė", "A user with that name already exists." : "Toks naudotojas jau yra.", + "To send a password link to the user an email address is required." : "Norint persiųsti slaptažodžio nuorodą, būtinas el. pašto adresas.", "Unable to create user." : "Nepavyko sukurti naudotojo.", "Unable to delete user." : "Nepavyko ištrinti naudotojo.", "Error while enabling user." : "Klaida įjungiant naudotoją.", "Error while disabling user." : "Klaida išjungiant naudotoją.", "Settings saved" : "Nustatymai įrašyti", "Unable to change full name" : "Nepavyko pakeisti pilno vardo", + "Unable to change email address" : "Nepavyko pakeisti el. pašto adresą", "Your full name has been changed." : "Pilnas vardas pakeistas.", + "Forbidden" : "Uždrausta", "Invalid user" : "Neteisingas naudotojas", "Unable to change mail address" : "Nepavyko pakeisti el. pašto adresą", "Email saved" : "El. paštas įrašytas", + "%1$s changed your password on %2$s." : "%1$s pakeitė jūsų slaptažodį %2$s", "The new email address is %s" : "Naujasis el. pašto adresas yra %s", "Your username is: %s" : "Jūsų naudotojo vardas yra: %s", "Your %s account was created" : "Jūsų paskyra %s sukurta", diff --git a/settings/l10n/zh_CN.js b/settings/l10n/zh_CN.js index 9c5f0b87db7..7547ce7d4a1 100644 --- a/settings/l10n/zh_CN.js +++ b/settings/l10n/zh_CN.js @@ -249,6 +249,7 @@ OC.L10N.register( "You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one." : "您需要从旧版本 (ownCloud<=8.0) 迁移您的加密密钥.", "Start migration" : "开始迁移", "Security & setup warnings" : "安全及设置警告", + "It's important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the Tips & Tricks section and the documentation for more information." : "你的每项配置对于实例的安全性和性能都至关重要。 为了帮助您,我们正在做一些自动检查。 有关详细信息,请参阅提示与技巧部分和文档。", "PHP does not seem to be setup properly to query system environment variables. The test with getenv(\"PATH\") only returns an empty response." : "PHP 的设置似乎有问题, 无法获取系统环境变量. 使用 getenv(\\\"PATH\\\") 测试时仅返回空结果.", "Please check the <a target=\"_blank\" rel=\"noreferrer\" href=\"%s\">installation documentation ↗</a> for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm." : "请检查 <a target=\"_blank\" rel=\"noreferrer\" href=\"%s\">安装文档 ↗</a> 中关于 PHP 配置的说明并在您的服务器中进行配置, 尤其是使用 php-fpm 时.", "The Read-Only config has been enabled. This prevents setting some configurations via the web-interface. Furthermore, the file needs to be made writable manually for every update." : "已启用只读配置. 这将阻止在 Web 界面中进行设置. 此外, 每次更新后该文件需要手动设置为可写入.", diff --git a/settings/l10n/zh_CN.json b/settings/l10n/zh_CN.json index a430f0c89ad..e43c4fe308e 100644 --- a/settings/l10n/zh_CN.json +++ b/settings/l10n/zh_CN.json @@ -247,6 +247,7 @@ "You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one." : "您需要从旧版本 (ownCloud<=8.0) 迁移您的加密密钥.", "Start migration" : "开始迁移", "Security & setup warnings" : "安全及设置警告", + "It's important for the security and performance of your instance that everything is configured correctly. To help you with that we are doing some automatic checks. Please see the Tips & Tricks section and the documentation for more information." : "你的每项配置对于实例的安全性和性能都至关重要。 为了帮助您,我们正在做一些自动检查。 有关详细信息,请参阅提示与技巧部分和文档。", "PHP does not seem to be setup properly to query system environment variables. The test with getenv(\"PATH\") only returns an empty response." : "PHP 的设置似乎有问题, 无法获取系统环境变量. 使用 getenv(\\\"PATH\\\") 测试时仅返回空结果.", "Please check the <a target=\"_blank\" rel=\"noreferrer\" href=\"%s\">installation documentation ↗</a> for PHP configuration notes and the PHP configuration of your server, especially when using php-fpm." : "请检查 <a target=\"_blank\" rel=\"noreferrer\" href=\"%s\">安装文档 ↗</a> 中关于 PHP 配置的说明并在您的服务器中进行配置, 尤其是使用 php-fpm 时.", "The Read-Only config has been enabled. This prevents setting some configurations via the web-interface. Furthermore, the file needs to be made writable manually for every update." : "已启用只读配置. 这将阻止在 Web 界面中进行设置. 此外, 每次更新后该文件需要手动设置为可写入.", diff --git a/settings/templates/settings/admin/server.development.notice.php b/settings/templates/settings/admin/server.development.notice.php index f58258fc0ae..d1af82bc9a9 100644 --- a/settings/templates/settings/admin/server.development.notice.php +++ b/settings/templates/settings/admin/server.development.notice.php @@ -1,3 +1,3 @@ <div class="section"> - <p><?php include(__DIR__ . '/../settings.development.notice.php'); ?></p> + <p><?php include(__DIR__ . '/../../settings.development.notice.php'); ?></p> </div> diff --git a/tests/Core/Controller/ClientFlowLoginControllerTest.php b/tests/Core/Controller/ClientFlowLoginControllerTest.php index 1132c0f540c..89253f13038 100644 --- a/tests/Core/Controller/ClientFlowLoginControllerTest.php +++ b/tests/Core/Controller/ClientFlowLoginControllerTest.php @@ -149,6 +149,11 @@ class ClientFlowLoginControllerTest extends TestCase { ->expects($this->once()) ->method('set') ->with('client.flow.state.token', 'StateToken'); + $this->session + ->expects($this->once()) + ->method('get') + ->with('oauth.state') + ->willReturn('OauthStateToken'); $this->defaults ->expects($this->once()) ->method('getName') @@ -168,6 +173,7 @@ class ClientFlowLoginControllerTest extends TestCase { 'urlGenerator' => $this->urlGenerator, 'stateToken' => 'StateToken', 'serverHost' => 'example.com', + 'oauthState' => 'OauthStateToken', ], 'guest' ); @@ -199,6 +205,11 @@ class ClientFlowLoginControllerTest extends TestCase { ->expects($this->once()) ->method('set') ->with('client.flow.state.token', 'StateToken'); + $this->session + ->expects($this->once()) + ->method('get') + ->with('oauth.state') + ->willReturn('OauthStateToken'); $this->defaults ->expects($this->once()) ->method('getName') @@ -218,6 +229,7 @@ class ClientFlowLoginControllerTest extends TestCase { 'urlGenerator' => $this->urlGenerator, 'stateToken' => 'StateToken', 'serverHost' => 'example.com', + 'oauthState' => 'OauthStateToken', ], 'guest' ); diff --git a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php index d623edbd9d9..4fa3b3d7e14 100644 --- a/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php +++ b/tests/lib/Authentication/TwoFactorAuth/ManagerTest.php @@ -566,6 +566,8 @@ class ManagerTest extends TestCase { } public function testNeedsSecondFactorInvalidToken() { + $this->prepareNoProviders(); + $user = $this->createMock(IUser::class); $user->method('getUID') ->willReturn('user'); @@ -579,6 +581,8 @@ class ManagerTest extends TestCase { ->with('mysessionid') ->willThrowException(new OC\Authentication\Exceptions\InvalidTokenException()); - $this->assertTrue($this->manager->needsSecondFactor($user)); + $this->config->method('getUserKeys')->willReturn([]); + + $this->assertFalse($this->manager->needsSecondFactor($user)); } } |