Skip to content

Commit

Permalink
Merge branch 'enh/add-x-nc-scope-property' of github.com:nextcloud/se…
Browse files Browse the repository at this point in the history
…rver into enh/add-x-nc-scope-property
  • Loading branch information
miaulalala committed May 8, 2023
2 parents 0f0c67c + 92ddc95 commit 6bf009b
Show file tree
Hide file tree
Showing 329 changed files with 1,430 additions and 1,284 deletions.
7 changes: 7 additions & 0 deletions apps/admin_audit/l10n/ast.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OC.L10N.register(
"admin_audit",
{
"Auditing / Logging" : "Auditoría / Rexistru",
"Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Forne la capacidá de rexistrar, por exemplu, l'accesu a los ficheros o a otres aiciones sensibles de Nextcloud"
},
"nplurals=2; plural=(n != 1);");
5 changes: 5 additions & 0 deletions apps/admin_audit/l10n/ast.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ "translations": {
"Auditing / Logging" : "Auditoría / Rexistru",
"Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Forne la capacidá de rexistrar, por exemplu, l'accesu a los ficheros o a otres aiciones sensibles de Nextcloud"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
7 changes: 7 additions & 0 deletions apps/admin_audit/l10n/eo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
OC.L10N.register(
"admin_audit",
{
"Auditing / Logging" : "Ekzamenado / Protokolado",
"Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Provizi protokolado-kapablojn por Nextcloud, kiel ekzemple protokolado de aliroj al dosieroj aŭ aliaj delikataj agoj."
},
"nplurals=2; plural=(n != 1);");
5 changes: 5 additions & 0 deletions apps/admin_audit/l10n/eo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{ "translations": {
"Auditing / Logging" : "Ekzamenado / Protokolado",
"Provides logging abilities for Nextcloud such as logging file accesses or otherwise sensitive actions." : "Provizi protokolado-kapablojn por Nextcloud, kiel ekzemple protokolado de aliroj al dosieroj aŭ aliaj delikataj agoj."
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
8 changes: 8 additions & 0 deletions apps/cloud_federation_api/l10n/eo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
OC.L10N.register(
"cloud_federation_api",
{
"Cloud Federation API" : "API de Nuba Federacio",
"Enable clouds to communicate with each other and exchange data" : "Ebligi interkomunikadon inter diversaj nuboj kaj la interŝanĝon de datumoj",
"The Cloud Federation API enables various Nextcloud instances to communicate with each other and to exchange data." : "La API de Nuba Federacio ebligas diversajn instancojn de Nextcloud interkomuniki kaj interŝanĝi datumojn inter si."
},
"nplurals=2; plural=(n != 1);");
6 changes: 6 additions & 0 deletions apps/cloud_federation_api/l10n/eo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{ "translations": {
"Cloud Federation API" : "API de Nuba Federacio",
"Enable clouds to communicate with each other and exchange data" : "Ebligi interkomunikadon inter diversaj nuboj kaj la interŝanĝon de datumoj",
"The Cloud Federation API enables various Nextcloud instances to communicate with each other and to exchange data." : "La API de Nuba Federacio ebligas diversajn instancojn de Nextcloud interkomuniki kaj interŝanĝi datumojn inter si."
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
1 change: 1 addition & 0 deletions apps/dav/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@
'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => $baseDir . '/../lib/Connector/Sabre/Exception/Forbidden.php',
'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => $baseDir . '/../lib/Connector/Sabre/Exception/InvalidPath.php',
'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => $baseDir . '/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php',
'OCA\\DAV\\Connector\\Sabre\\Exception\\TooManyRequests' => $baseDir . '/../lib/Connector/Sabre/Exception/TooManyRequests.php',
'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => $baseDir . '/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php',
'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => $baseDir . '/../lib/Connector/Sabre/FakeLockerPlugin.php',
'OCA\\DAV\\Connector\\Sabre\\File' => $baseDir . '/../lib/Connector/Sabre/File.php',
Expand Down
1 change: 1 addition & 0 deletions apps/dav/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ class ComposerStaticInitDAV
'OCA\\DAV\\Connector\\Sabre\\Exception\\Forbidden' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/Forbidden.php',
'OCA\\DAV\\Connector\\Sabre\\Exception\\InvalidPath' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/InvalidPath.php',
'OCA\\DAV\\Connector\\Sabre\\Exception\\PasswordLoginForbidden' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/PasswordLoginForbidden.php',
'OCA\\DAV\\Connector\\Sabre\\Exception\\TooManyRequests' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/TooManyRequests.php',
'OCA\\DAV\\Connector\\Sabre\\Exception\\UnsupportedMediaType' => __DIR__ . '/..' . '/../lib/Connector/Sabre/Exception/UnsupportedMediaType.php',
'OCA\\DAV\\Connector\\Sabre\\FakeLockerPlugin' => __DIR__ . '/..' . '/../lib/Connector/Sabre/FakeLockerPlugin.php',
'OCA\\DAV\\Connector\\Sabre\\File' => __DIR__ . '/..' . '/../lib/Connector/Sabre/File.php',
Expand Down
1 change: 1 addition & 0 deletions apps/dav/l10n/it.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ OC.L10N.register(
"Due on %s by %s" : "Scade il %s per %s",
"Due on %s" : "Scade il %s",
"Migrated calendar (%1$s)" : "Calendario migrato (%1$s)",
"Calendars including events, details and attendees" : "Calendari inclusi eventi, dettagli e partecipanti",
"Contacts and groups" : "Contatti e gruppi",
"WebDAV" : "WebDAV",
"WebDAV endpoint" : "Terminatore WebDAV",
Expand Down
1 change: 1 addition & 0 deletions apps/dav/l10n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
"Due on %s by %s" : "Scade il %s per %s",
"Due on %s" : "Scade il %s",
"Migrated calendar (%1$s)" : "Calendario migrato (%1$s)",
"Calendars including events, details and attendees" : "Calendari inclusi eventi, dettagli e partecipanti",
"Contacts and groups" : "Contatti e gruppi",
"WebDAV" : "WebDAV",
"WebDAV endpoint" : "Terminatore WebDAV",
Expand Down
3 changes: 3 additions & 0 deletions apps/dav/l10n/pl.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ OC.L10N.register(
"Cancelled: %1$s" : "Anulowane: %1$s",
"\"%1$s\" has been canceled" : "\"%1$s\" zostało anulowane",
"Re: %1$s" : "Odp: %1$s",
"%1$s has accepted your invitation" : "Twoje zaproszenie zostało zaakceptowane przez %1$s",
"%1$s has tentatively accepted your invitation" : "Twoje zaproszenie zostało wstępnie zaakceptowane przez %1$s",
"%1$s has declined your invitation" : "Twoje zaproszenie zostało odrzucone przez %1$s",
"%1$s has responded to your invitation" : "%1$s odpowiedział/a na Twoje zaproszenie",
"Invitation updated: %1$s" : "Zaktualizowano zaproszenie: %1$s",
"%1$s updated the event \"%2$s\"" : "%1$s zaktualizował/a wydarzenie \"%2$s\"",
Expand Down
3 changes: 3 additions & 0 deletions apps/dav/l10n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@
"Cancelled: %1$s" : "Anulowane: %1$s",
"\"%1$s\" has been canceled" : "\"%1$s\" zostało anulowane",
"Re: %1$s" : "Odp: %1$s",
"%1$s has accepted your invitation" : "Twoje zaproszenie zostało zaakceptowane przez %1$s",
"%1$s has tentatively accepted your invitation" : "Twoje zaproszenie zostało wstępnie zaakceptowane przez %1$s",
"%1$s has declined your invitation" : "Twoje zaproszenie zostało odrzucone przez %1$s",
"%1$s has responded to your invitation" : "%1$s odpowiedział/a na Twoje zaproszenie",
"Invitation updated: %1$s" : "Zaktualizowano zaproszenie: %1$s",
"%1$s updated the event \"%2$s\"" : "%1$s zaktualizował/a wydarzenie \"%2$s\"",
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/Reminder/ReminderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public function processReminders() :void {
continue;
}

if ($this->config->getAppValue('dav', 'sendEventRemindersToSharedGroupMembers', 'yes') === 'no') {
if ($this->config->getAppValue('dav', 'sendEventRemindersToSharedUsers', 'yes') === 'no') {
$users = $this->getAllUsersWithWriteAccessToCalendar($reminder['calendar_id']);
} else {
$users = [];
Expand Down
1 change: 1 addition & 0 deletions apps/dav/lib/CardDAV/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public function createCardFromUser(IUser $user): ?VCard {
$vCard->add('PHOTO', $image->data(), ['ENCODING' => 'b', 'TYPE' => $image->mimeType(), ['X-NC-SCOPE' => $scope]]);
}
break;
case IAccountManager::COLLECTION_EMAIL:
case IAccountManager::PROPERTY_EMAIL:
$vCard->add(new Text($vCard, 'EMAIL', $property->getValue(), ['TYPE' => 'OTHER', 'X-NC-SCOPE' => $scope]));
break;
Expand Down
6 changes: 6 additions & 0 deletions apps/dav/lib/Connector/Sabre/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@
use OC\Authentication\Exceptions\PasswordLoginForbiddenException;
use OC\Authentication\TwoFactorAuth\Manager;
use OC\Security\Bruteforce\Throttler;
use OC\User\LoginException;
use OC\User\Session;
use OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden;
use OCA\DAV\Connector\Sabre\Exception\TooManyRequests;
use OCP\IRequest;
use OCP\ISession;
use OCP\Security\Bruteforce\MaxDelayReached;
use Psr\Log\LoggerInterface;
use Sabre\DAV\Auth\Backend\AbstractBasic;
use Sabre\DAV\Exception\NotAuthenticated;
Expand Down Expand Up @@ -119,6 +122,9 @@ protected function validateUserPass($username, $password) {
} catch (PasswordLoginForbiddenException $ex) {
$this->session->close();
throw new PasswordLoginForbidden();
} catch (MaxDelayReached $ex) {
$this->session->close();
throw new TooManyRequests();
}
}
}
Expand Down
55 changes: 55 additions & 0 deletions apps/dav/lib/Connector/Sabre/Exception/TooManyRequests.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

declare(strict_types=1);
/**
* @copyright Copyright (c) 2023 Joas Schilling <[email protected]>
*
* @author Joas Schilling <[email protected]>
*
* @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 OCA\DAV\Connector\Sabre\Exception;

use DOMElement;
use Sabre\DAV\Exception\NotAuthenticated;
use Sabre\DAV\Server;

class TooManyRequests extends NotAuthenticated {
public const NS_OWNCLOUD = 'http://owncloud.org/ns';

public function getHTTPCode() {
return 429;
}

/**
* This method allows the exception to include additional information
* into the WebDAV error response
*
* @param Server $server
* @param DOMElement $errorNode
* @return void
*/
public function serialize(Server $server, DOMElement $errorNode) {

// set ownCloud namespace
$errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD);

$error = $errorNode->ownerDocument->createElementNS('o:', 'o:hint', 'too many requests');
$errorNode->appendChild($error);
}
}
2 changes: 1 addition & 1 deletion apps/dav/lib/Settings/CalDAVSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class CalDAVSettings implements IDelegatedSettings {
'sendInvitations' => 'yes',
'generateBirthdayCalendar' => 'yes',
'sendEventReminders' => 'yes',
'sendEventRemindersToSharedGroupMembers' => 'yes',
'sendEventRemindersToSharedUsers' => 'yes',
'sendEventRemindersPush' => 'no',
];

Expand Down
4 changes: 2 additions & 2 deletions apps/dav/src/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const CalDavSettingsView = new View({
'generateBirthdayCalendar'
),
sendEventReminders: loadState('dav', 'sendEventReminders'),
sendEventRemindersToSharedGroupMembers: loadState(
sendEventRemindersToSharedUsers: loadState(
'dav',
'sendEventRemindersToSharedGroupMembers'
'sendEventRemindersToSharedUsers'
),
sendEventRemindersPush: loadState('dav', 'sendEventRemindersPush'),
}
Expand Down
10 changes: 5 additions & 5 deletions apps/dav/src/views/CalDavSettings.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('CalDavSettings', () => {
sendInvitations: true,
generateBirthdayCalendar: true,
sendEventReminders: true,
sendEventRemindersToSharedGroupMembers: true,
sendEventRemindersToSharedUsers: true,
sendEventRemindersPush: true,
}
},
Expand All @@ -65,10 +65,10 @@ describe('CalDavSettings', () => {
'Send notifications for events'
)
expect(sendEventReminders).toBeChecked()
const sendEventRemindersToSharedGroupMembers = TLUtils.getByLabelText(
const sendEventRemindersToSharedUsers = TLUtils.getByLabelText(
'Send reminder notifications to calendar sharees as well'
)
expect(sendEventRemindersToSharedGroupMembers).toBeChecked()
expect(sendEventRemindersToSharedUsers).toBeChecked()
const sendEventRemindersPush = TLUtils.getByLabelText(
'Enable notifications for events via push'
)
Expand Down Expand Up @@ -114,7 +114,7 @@ describe('CalDavSettings', () => {
'no'
)
expect(sendEventRemindersToSharedGroupMembers).toBeDisabled()
expect(sendEventRemindersToSharedUsers).toBeDisabled()
expect(sendEventRemindersPush).toBeDisabled()
OCP.AppConfig.setValue.mockClear()
Expand All @@ -126,7 +126,7 @@ describe('CalDavSettings', () => {
'yes'
)
expect(sendEventRemindersToSharedGroupMembers).toBeEnabled()
expect(sendEventRemindersToSharedUsers).toBeEnabled()
expect(sendEventRemindersPush).toBeEnabled()
*/
})
Expand Down
6 changes: 3 additions & 3 deletions apps/dav/src/views/CalDavSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</p>
<p class="indented">
<NcCheckboxRadioSwitch id="caldavSendEventRemindersToSharedGroupMembers"
:checked.sync="sendEventRemindersToSharedGroupMembers"
:checked.sync="sendEventRemindersToSharedUsers"
type="switch"
:disabled="!sendEventReminders">
{{ $t('dav', 'Send reminder notifications to calendar sharees as well' ) }}
Expand Down Expand Up @@ -130,10 +130,10 @@ export default {
sendEventReminders(value) {
OCP.AppConfig.setValue('dav', 'sendEventReminders', value ? 'yes' : 'no')
},
sendEventRemindersToSharedGroupMembers(value) {
sendEventRemindersToSharedUsers(value) {
OCP.AppConfig.setValue(
'dav',
'sendEventRemindersToSharedGroupMembers',
'sendEventRemindersToSharedUsers',
value ? 'yes' : 'no'
)
},
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/tests/unit/Settings/CalDAVSettingsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function testGetForm(): void {
['dav', 'sendInvitations', 'yes'],
['dav', 'generateBirthdayCalendar', 'yes'],
['dav', 'sendEventReminders', 'yes'],
['dav', 'sendEventRemindersToSharedGroupMembers', 'yes'],
['dav', 'sendEventRemindersToSharedUsers', 'yes'],
['dav', 'sendEventRemindersPush', 'no'],
)
->will($this->onConsecutiveCalls('yes', 'no', 'yes', 'yes', 'yes'));
Expand All @@ -76,7 +76,7 @@ public function testGetForm(): void {
['sendInvitations', true],
['generateBirthdayCalendar', false],
['sendEventReminders', true],
['sendEventRemindersToSharedGroupMembers', true],
['sendEventRemindersToSharedUsers', true],
['sendEventRemindersPush', true],
);
$result = $this->settings->getForm();
Expand Down
8 changes: 6 additions & 2 deletions apps/federation/lib/SyncFederationAddressBooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,14 @@ public function syncThemAll(\Closure $callback) {
} catch (\Exception $ex) {
if ($ex->getCode() === Http::STATUS_UNAUTHORIZED) {
$this->dbHandler->setServerStatus($url, TrustedServers::STATUS_ACCESS_REVOKED);
$this->logger->error("Server sync for $url failed because of revoked access.");
$this->logger->error("Server sync for $url failed because of revoked access.", [
'exception' => $ex,
]);
} else {
$this->dbHandler->setServerStatus($url, TrustedServers::STATUS_FAILURE);
$this->logger->error("Server sync for $url failed.");
$this->logger->error("Server sync for $url failed.", [
'exception' => $ex,
]);
}
$callback($url, $ex);
}
Expand Down
Loading

0 comments on commit 6bf009b

Please sign in to comment.