Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c63433cde | |||
| a283200dcb | |||
| abecd5696b | |||
| 13e6a0db2c | |||
| 33b06cfa0c | |||
| 138eddc0f1 | |||
| 703d8f2adc | |||
| 745667e426 | |||
| 5c0f06b259 | |||
| 5763ce2761 | |||
| b9cb5a74cc | |||
| 822d3f0e8b | |||
| e003fcd806 | |||
| dd15780edd | |||
| 214221574b | |||
| aac0dd1f20 | |||
| b0cfa3ed22 | |||
| 231eaf6ffd | |||
| be37ca1776 | |||
| ffc3b48a40 | |||
| 9d7198f31e | |||
| c4b2b1ec7d | |||
| 1310836edd | |||
| b0a7ff1a99 | |||
| 321551a94f | |||
| 60fd1a30b2 | |||
| 3d201d70ba | |||
| e2357d5df1 | |||
| ffb4d54bc0 | |||
| acdd9362df | |||
| 9c23d6355f | |||
| 9fd725c84a | |||
| 21f8cc584c | |||
| 203d85f045 | |||
| 1331eb1fb8 | |||
| c19d639231 | |||
| 8e9433aee9 | |||
| c37bb7745b | |||
| 4bde23d239 | |||
| 387af7eb60 | |||
| 6b6d28ee98 | |||
| 1a58e3afbe | |||
| 78480def53 | |||
| e048bf8550 | |||
| d1909526fc | |||
| adbdecb1d6 | |||
| 76334c4c90 | |||
| 3ebecaec52 | |||
| 1d6772c1be | |||
| 4d0f008dcb | |||
| 90a65f83e0 | |||
| 3365ab787a |
@@ -34,7 +34,6 @@ use OCA\DAV\DAV\Sharing\Plugin;
|
||||
use OCP\AppFramework\Db\DoesNotExistException;
|
||||
use OCP\IL10N;
|
||||
use Sabre\DAV\Exception\NotFound;
|
||||
use Sabre\DAV\Exception\NotImplemented;
|
||||
use Sabre\DAV\PropPatch;
|
||||
use Sabre\DAVACL\ACLTrait;
|
||||
use Sabre\DAVACL\IACL;
|
||||
@@ -130,8 +129,8 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getLastModified() {
|
||||
throw new NotImplemented();
|
||||
public function getLastModified(): ?int {
|
||||
return $this->mapper->findLastUpdatedForUserId($this->getUid());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,6 +148,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
||||
'principaluri' => $this->principalUri,
|
||||
'{DAV:}displayname' => $this->l10n->t('Recently contacted'),
|
||||
'{' . Plugin::NS_OWNCLOUD . '}read-only' => true,
|
||||
'{' . \OCA\DAV\CalDAV\Plugin::NS_CALENDARSERVER . '}getctag' => 'http://sabre.io/ns/sync/' . ($this->getLastModified() ?? 0),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,7 @@ class Card implements ICard, IACL {
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getETag(): ?string {
|
||||
return null;
|
||||
return '"' . md5((string) $this->getLastModified()) . '"';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -104,6 +104,30 @@ class RecentContactMapper extends QBMapper {
|
||||
return $this->findEntities($select);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $uid
|
||||
* @return int|null
|
||||
*/
|
||||
public function findLastUpdatedForUserId(string $uid):?int {
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
|
||||
$select = $qb
|
||||
->select('last_contact')
|
||||
->from($this->getTableName())
|
||||
->where($qb->expr()->eq('actor_uid', $qb->createNamedParameter($uid)))
|
||||
->orderBy('last_contact', 'DESC')
|
||||
->setMaxResults(1);
|
||||
|
||||
$cursor = $select->execute();
|
||||
$row = $cursor->fetch();
|
||||
|
||||
if ($row === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (int)$row['last_contact'];
|
||||
}
|
||||
|
||||
public function cleanUp(int $olderThan): void {
|
||||
$qb = $this->db->getQueryBuilder();
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ use Sabre\DAV;
|
||||
abstract class ExternalAddressBook implements IAddressBook, DAV\IProperties {
|
||||
|
||||
/** @var string */
|
||||
private const PREFIX = 'app-generated';
|
||||
private const PREFIX = 'z-app-generated';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
|
||||
+1
-1
@@ -9,6 +9,6 @@
|
||||
},
|
||||
"require": {
|
||||
"icewind/streams": "0.7.1",
|
||||
"icewind/smb": "3.2.3"
|
||||
"icewind/smb": "3.2.4"
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -4,20 +4,20 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "ef0d9929f5f25696e010d5733eb51fbb",
|
||||
"content-hash": "9454f546b6ab8865140c991e8f197951",
|
||||
"packages": [
|
||||
{
|
||||
"name": "icewind/smb",
|
||||
"version": "v3.2.3",
|
||||
"version": "v3.2.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/icewind1991/SMB.git",
|
||||
"reference": "db50bb51bd0a0e55506e82cf439a9ecd232f64d4"
|
||||
"reference": "999d6687ca9d4ac2600185c935b45206e47e604a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/db50bb51bd0a0e55506e82cf439a9ecd232f64d4",
|
||||
"reference": "db50bb51bd0a0e55506e82cf439a9ecd232f64d4",
|
||||
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/999d6687ca9d4ac2600185c935b45206e47e604a",
|
||||
"reference": "999d6687ca9d4ac2600185c935b45206e47e604a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -46,7 +46,7 @@
|
||||
}
|
||||
],
|
||||
"description": "php wrapper for smbclient and libsmbclient-php",
|
||||
"time": "2020-04-08T15:20:22+00:00"
|
||||
"time": "2020-05-11T14:12:35+00:00"
|
||||
},
|
||||
{
|
||||
"name": "icewind/streams",
|
||||
|
||||
+6
-6
@@ -1,17 +1,17 @@
|
||||
[
|
||||
{
|
||||
"name": "icewind/smb",
|
||||
"version": "v3.2.3",
|
||||
"version_normalized": "3.2.3.0",
|
||||
"version": "v3.2.4",
|
||||
"version_normalized": "3.2.4.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/icewind1991/SMB.git",
|
||||
"reference": "db50bb51bd0a0e55506e82cf439a9ecd232f64d4"
|
||||
"reference": "999d6687ca9d4ac2600185c935b45206e47e604a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/db50bb51bd0a0e55506e82cf439a9ecd232f64d4",
|
||||
"reference": "db50bb51bd0a0e55506e82cf439a9ecd232f64d4",
|
||||
"url": "https://api.github.com/repos/icewind1991/SMB/zipball/999d6687ca9d4ac2600185c935b45206e47e604a",
|
||||
"reference": "999d6687ca9d4ac2600185c935b45206e47e604a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -22,7 +22,7 @@
|
||||
"friendsofphp/php-cs-fixer": "^2.13",
|
||||
"phpunit/phpunit": "^7.0"
|
||||
},
|
||||
"time": "2020-04-08T15:20:22+00:00",
|
||||
"time": "2020-05-11T14:12:35+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "dist",
|
||||
"autoload": {
|
||||
|
||||
@@ -31,11 +31,6 @@ class NativeFileInfo implements IFileInfo {
|
||||
*/
|
||||
protected $attributeCache = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $modeCache;
|
||||
|
||||
/**
|
||||
* @param NativeShare $share
|
||||
* @param string $path
|
||||
@@ -69,7 +64,7 @@ class NativeFileInfo implements IFileInfo {
|
||||
$rawAttributes = explode(',', $this->share->getAttribute($this->path, 'system.dos_attr.*'));
|
||||
$this->attributeCache = [];
|
||||
foreach ($rawAttributes as $rawAttribute) {
|
||||
[$name, $value] = explode(':', $rawAttribute);
|
||||
list($name, $value) = explode(':', $rawAttribute);
|
||||
$name = strtolower($name);
|
||||
if ($name == 'mode') {
|
||||
$this->attributeCache[$name] = (int)hexdec(substr($value, 2));
|
||||
@@ -97,6 +92,18 @@ class NativeFileInfo implements IFileInfo {
|
||||
return $stat['change_time'];
|
||||
}
|
||||
|
||||
/**
|
||||
* On "mode":
|
||||
*
|
||||
* different smbclient versions seem to return different mode values for 'system.dos_attr.mode'
|
||||
*
|
||||
* older versions return the dos permissions mask as defined in `IFileInfo::MODE_*` while
|
||||
* newer versions return the equivalent unix permission mask.
|
||||
*
|
||||
* Since the unix mask doesn't contain the proper hidden/archive/system flags we have to assume them
|
||||
* as false (except for `hidden` where we use the unix dotfile convention)
|
||||
*/
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
@@ -109,7 +116,11 @@ class NativeFileInfo implements IFileInfo {
|
||||
*/
|
||||
public function isDirectory() {
|
||||
$mode = $this->getMode();
|
||||
return (bool)($mode & IFileInfo::MODE_DIRECTORY);
|
||||
if ($mode > 0x80) {
|
||||
return (bool)($mode & 0x4000); // 0x80: unix directory flag
|
||||
} else {
|
||||
return (bool)($mode & IFileInfo::MODE_DIRECTORY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,7 +128,11 @@ class NativeFileInfo implements IFileInfo {
|
||||
*/
|
||||
public function isReadOnly() {
|
||||
$mode = $this->getMode();
|
||||
return (bool)($mode & IFileInfo::MODE_READONLY);
|
||||
if ($mode > 0x80) {
|
||||
return !(bool)($mode & 0x80); // 0x80: owner write permissions
|
||||
} else {
|
||||
return (bool)($mode & IFileInfo::MODE_READONLY);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -125,7 +140,11 @@ class NativeFileInfo implements IFileInfo {
|
||||
*/
|
||||
public function isHidden() {
|
||||
$mode = $this->getMode();
|
||||
return (bool)($mode & IFileInfo::MODE_HIDDEN);
|
||||
if ($mode > 0x80) {
|
||||
return $this->name[0] === '.';
|
||||
} else {
|
||||
return (bool)($mode & IFileInfo::MODE_HIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -133,7 +152,11 @@ class NativeFileInfo implements IFileInfo {
|
||||
*/
|
||||
public function isSystem() {
|
||||
$mode = $this->getMode();
|
||||
return (bool)($mode & IFileInfo::MODE_SYSTEM);
|
||||
if ($mode > 0x80) {
|
||||
return false;
|
||||
} else {
|
||||
return (bool)($mode & IFileInfo::MODE_SYSTEM);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +164,11 @@ class NativeFileInfo implements IFileInfo {
|
||||
*/
|
||||
public function isArchived() {
|
||||
$mode = $this->getMode();
|
||||
return (bool)($mode & IFileInfo::MODE_ARCHIVE);
|
||||
if ($mode > 0x80) {
|
||||
return false;
|
||||
} else {
|
||||
return (bool)($mode & IFileInfo::MODE_ARCHIVE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,8 +179,8 @@ class NativeFileInfo implements IFileInfo {
|
||||
$attribute = $this->share->getAttribute($this->path, 'system.nt_sec_desc.acl.*+');
|
||||
|
||||
foreach (explode(',', $attribute) as $acl) {
|
||||
[$user, $permissions] = explode(':', $acl, 2);
|
||||
[$type, $flags, $mask] = explode('/', $permissions);
|
||||
list($user, $permissions) = explode(':', $acl, 2);
|
||||
list($type, $flags, $mask) = explode('/', $permissions);
|
||||
$mask = hexdec($mask);
|
||||
|
||||
$acls[$user] = new ACL($type, $flags, $mask);
|
||||
|
||||
+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
@@ -152,7 +152,8 @@ OCA.Sharing.PublicApp = {
|
||||
img.attr('src', $('#downloadURL').val());
|
||||
imgcontainer.appendTo('#imgframe');
|
||||
} else if (mimetype.substr(0, mimetype.indexOf('/')) === 'text' && window.btoa) {
|
||||
if (OC.appswebroots['files_texteditor'] !== undefined) {
|
||||
if (OC.appswebroots['files_texteditor'] !== undefined ||
|
||||
OC.appswebroots['text'] !== undefined) {
|
||||
// the text editor handles the previewing
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -216,15 +216,6 @@ class ShareAPIController extends OCSController {
|
||||
$result['expiration'] = $expiration->format('Y-m-d 00:00:00');
|
||||
}
|
||||
|
||||
// TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones
|
||||
// For link shares, we need to have the PERMISSION_SHARE if federated is enabled
|
||||
if ($this->shareManager->outgoingServer2ServerSharesAllowed()) {
|
||||
if ($share->getShareType() === IShare::TYPE_LINK
|
||||
|| $share->getShareType() === IShare::TYPE_EMAIL) {
|
||||
$result['permissions'] |= Constants::PERMISSION_SHARE;
|
||||
}
|
||||
}
|
||||
|
||||
if ($share->getShareType() === IShare::TYPE_USER) {
|
||||
$sharedWith = $this->userManager->get($share->getSharedWith());
|
||||
$result['share_with'] = $share->getSharedWith();
|
||||
@@ -511,6 +502,11 @@ class ShareAPIController extends OCSController {
|
||||
$permissions = Constants::PERMISSION_READ;
|
||||
}
|
||||
|
||||
// TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones
|
||||
if (($permissions & Constants::PERMISSION_READ) && $this->shareManager->outgoingServer2ServerSharesAllowed()) {
|
||||
$permissions |= Constants::PERMISSION_SHARE;
|
||||
}
|
||||
|
||||
$share->setPermissions($permissions);
|
||||
|
||||
// Set password
|
||||
@@ -1055,6 +1051,11 @@ class ShareAPIController extends OCSController {
|
||||
}
|
||||
|
||||
if ($newPermissions !== null) {
|
||||
// TODO: It might make sense to have a dedicated setting to allow/deny converting link shares into federated ones
|
||||
if (($newPermissions & Constants::PERMISSION_READ) && $this->shareManager->outgoingServer2ServerSharesAllowed()) {
|
||||
$newPermissions |= Constants::PERMISSION_SHARE;
|
||||
}
|
||||
|
||||
$share->setPermissions($newPermissions);
|
||||
$permissions = $newPermissions;
|
||||
}
|
||||
|
||||
@@ -183,12 +183,18 @@ export default {
|
||||
},
|
||||
|
||||
watch: {
|
||||
fileInfo() {
|
||||
this.resetState()
|
||||
this.getShares()
|
||||
fileInfo(newFile, oldFile) {
|
||||
if (newFile.id !== oldFile.id) {
|
||||
this.resetState()
|
||||
this.getShares()
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
beforeMount() {
|
||||
this.getShares()
|
||||
},
|
||||
|
||||
methods: {
|
||||
/**
|
||||
* Get the existing shares infos
|
||||
|
||||
@@ -999,7 +999,8 @@ class ApiTest extends TestCase {
|
||||
\OCP\Constants::PERMISSION_READ |
|
||||
\OCP\Constants::PERMISSION_CREATE |
|
||||
\OCP\Constants::PERMISSION_UPDATE |
|
||||
\OCP\Constants::PERMISSION_DELETE,
|
||||
\OCP\Constants::PERMISSION_DELETE |
|
||||
\OCP\Constants::PERMISSION_SHARE,
|
||||
$share1->getPermissions()
|
||||
);
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ abstract class AUserData extends OCSController {
|
||||
$data[AccountManager::PROPERTY_WEBSITE] = $userAccount[AccountManager::PROPERTY_WEBSITE]['value'];
|
||||
$data[AccountManager::PROPERTY_TWITTER] = $userAccount[AccountManager::PROPERTY_TWITTER]['value'];
|
||||
$data['groups'] = $gids;
|
||||
$data['language'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'lang');
|
||||
$data['language'] = $this->config->getSystemValue('force_language', $this->config->getUserValue($targetUserObject->getUID(), 'core', 'lang'));
|
||||
$data['locale'] = $this->config->getUserValue($targetUserObject->getUID(), 'core', 'locale');
|
||||
|
||||
$backend = $targetUserObject->getBackend();
|
||||
|
||||
@@ -225,7 +225,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->assertEquals($expected, $this->api->getUsers('MyCustomSearch')->getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddUserAlreadyExisting() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(102);
|
||||
@@ -259,7 +259,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->addUser('AlreadyExistingUser', 'password', '', '', []);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddUserNonExistingGroup() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('group NonExistingGroup does not exist');
|
||||
@@ -295,7 +295,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->addUser('NewUser', 'pass', '', '', ['NonExistingGroup']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddUserExistingGroupNonExistingGroup() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('group NonExistingGroup does not exist');
|
||||
@@ -487,7 +487,7 @@ class UsersControllerTest extends TestCase {
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddUserFailedToGenerateUserID() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Could not create non-existing user id');
|
||||
@@ -530,7 +530,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->addUser('', 'PasswordOfTheNewUser')->getData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddUserEmailRequired() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Required email address was not provided');
|
||||
@@ -637,7 +637,7 @@ class UsersControllerTest extends TestCase {
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddUserUnsuccessful() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Bad request');
|
||||
@@ -682,7 +682,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->addUser('NewUser', 'PasswordOfTheNewUser');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddUserAsSubAdminNoGroup() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('no group specified (required for subadmins)');
|
||||
@@ -715,7 +715,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->addUser('NewUser', 'PasswordOfTheNewUser', '', '', []);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddUserAsSubAdminValidGroupNotSubAdmin() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('insufficient privileges for group ExistingGroup');
|
||||
@@ -858,7 +858,7 @@ class UsersControllerTest extends TestCase {
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testGetUserTargetDoesNotExist() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('User does not exist');
|
||||
@@ -958,6 +958,11 @@ class UsersControllerTest extends TestCase {
|
||||
->method('getUserValue')
|
||||
->with('UID', 'core', 'lang')
|
||||
->willReturn('de');
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('force_language', 'de')
|
||||
->willReturn('de');
|
||||
$this->api
|
||||
->expects($this->once())
|
||||
->method('fillStorageInfo')
|
||||
@@ -1073,6 +1078,11 @@ class UsersControllerTest extends TestCase {
|
||||
->method('getUserValue')
|
||||
->with('UID', 'core', 'enabled', 'true')
|
||||
->willReturn('true');
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('force_language', 'da')
|
||||
->willReturn('da');
|
||||
$this->config
|
||||
->expects($this->at(1))
|
||||
->method('getUserValue')
|
||||
@@ -1150,7 +1160,7 @@ class UsersControllerTest extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function testGetUserDataAsSubAdminAndUserIsNotAccessible() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(997);
|
||||
@@ -1245,6 +1255,11 @@ class UsersControllerTest extends TestCase {
|
||||
->method('fillStorageInfo')
|
||||
->with('UID')
|
||||
->willReturn(['DummyValue']);
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getSystemValue')
|
||||
->with('force_language', 'ru')
|
||||
->willReturn('ru');
|
||||
|
||||
$backend = $this->createMock(UserInterface::class);
|
||||
$backend->expects($this->atLeastOnce())
|
||||
@@ -1384,7 +1399,7 @@ class UsersControllerTest extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function testEditUserRegularUserSelfEditChangeEmailInvalid() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(102);
|
||||
@@ -1453,7 +1468,7 @@ class UsersControllerTest extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function testEditUserRegularUserSelfEditChangeQuota() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(997);
|
||||
@@ -1518,7 +1533,7 @@ class UsersControllerTest extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function testEditUserAdminUserSelfEditChangeInvalidQuota() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Invalid quota value ABC');
|
||||
@@ -1809,7 +1824,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->assertEquals([], $this->api->editUser('UserToEdit', 'quota', '3042824')->getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testEditUserSubadminUserInaccessible() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(997);
|
||||
@@ -1849,7 +1864,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->editUser('UserToEdit', 'quota', 'value');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testDeleteUserNotExistingUser() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(101);
|
||||
@@ -1872,7 +1887,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->deleteUser('UserToDelete');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testDeleteUserSelf() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(101);
|
||||
@@ -1933,7 +1948,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->assertEquals([], $this->api->deleteUser('UserToDelete')->getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testDeleteUnsuccessfulUserAsAdmin() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(101);
|
||||
@@ -2014,7 +2029,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->assertEquals([], $this->api->deleteUser('UserToDelete')->getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testDeleteUnsuccessfulUserAsSubadmin() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(101);
|
||||
@@ -2062,7 +2077,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->deleteUser('UserToDelete');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testDeleteUserAsSubAdminAndUserIsNotAccessible() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(997);
|
||||
@@ -2106,7 +2121,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->deleteUser('UserToDelete');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testGetUsersGroupsTargetUserNotExisting() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(998);
|
||||
@@ -2243,7 +2258,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->assertEquals(['groups' => ['Group1']], $this->api->getUsersGroups('UserToLookup')->getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testGetUsersGroupsForSubAdminUserAndUserIsInaccessible() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(997);
|
||||
@@ -2292,7 +2307,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->getUsersGroups('UserToLookup');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddToGroupWithTargetGroupNotExisting() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(102);
|
||||
@@ -2305,7 +2320,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->addToGroup('TargetUser', 'GroupToAddTo');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddToGroupWithNoGroupSpecified() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(101);
|
||||
@@ -2313,7 +2328,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->addToGroup('TargetUser');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddToGroupWithTargetUserNotExisting() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(103);
|
||||
@@ -2327,7 +2342,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->addToGroup('TargetUser', 'GroupToAddTo');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddToGroupNoSubadmin() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(104);
|
||||
@@ -2461,7 +2476,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->assertEquals(new DataResponse(), $this->api->addToGroup('TargetUser', 'GroupToAddTo'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testRemoveFromGroupWithNoTargetGroup() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(101);
|
||||
@@ -2475,7 +2490,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->removeFromGroup('TargetUser', '');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testRemoveFromGroupWithEmptyTargetGroup() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(101);
|
||||
@@ -2489,7 +2504,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->removeFromGroup('TargetUser', '');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testRemoveFromGroupWithNotExistingTargetGroup() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(102);
|
||||
@@ -2508,7 +2523,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->removeFromGroup('TargetUser', 'TargetGroup');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testRemoveFromGroupWithNotExistingTargetUser() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(103);
|
||||
@@ -2533,7 +2548,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->removeFromGroup('TargetUser', 'TargetGroup');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testRemoveFromGroupWithoutPermission() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(104);
|
||||
@@ -2574,7 +2589,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->removeFromGroup('TargetUser', 'TargetGroup');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testRemoveFromGroupAsAdminFromAdmin() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Cannot remove yourself from the admin group');
|
||||
@@ -2624,7 +2639,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->removeFromGroup('Admin', 'admin');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testRemoveFromGroupAsSubAdminFromSubAdmin() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Cannot remove yourself from this group as you are a SubAdmin');
|
||||
@@ -2679,7 +2694,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->removeFromGroup('SubAdmin', 'subadmin');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testRemoveFromGroupAsSubAdminFromLastSubAdminGroup() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Not viable to remove user from the last group you are SubAdmin of');
|
||||
@@ -2782,7 +2797,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->assertEquals([], $this->api->removeFromGroup('AnotherUser', 'admin')->getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddSubAdminWithNotExistingTargetUser() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('User does not exist');
|
||||
@@ -2797,7 +2812,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->addSubAdmin('NotExistingUser', '');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddSubAdminWithNotExistingTargetGroup() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Group does not exist');
|
||||
@@ -2819,7 +2834,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->addSubAdmin('ExistingUser', 'NotExistingGroup');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testAddSubAdminToAdminGroup() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Cannot create subadmins for admin group');
|
||||
@@ -2906,7 +2921,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->assertEquals([], $this->api->addSubAdmin('ExistingUser', 'TargetGroup')->getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testRemoveSubAdminNotExistingTargetUser() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('User does not exist');
|
||||
@@ -2921,7 +2936,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->removeSubAdmin('NotExistingUser', 'GroupToDeleteFrom');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testRemoveSubAdminNotExistingTargetGroup() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Group does not exist');
|
||||
@@ -2943,7 +2958,7 @@ class UsersControllerTest extends TestCase {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function testRemoveSubAdminFromNotASubadmin() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('User is not a subadmin of this group');
|
||||
@@ -3009,7 +3024,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->assertEquals([], $this->api->removeSubAdmin('ExistingUser', 'GroupToDeleteFrom')->getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testGetUserSubAdminGroupsNotExistingTargetUser() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('User does not exist');
|
||||
@@ -3163,7 +3178,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->assertSame($expected, $api->getCurrentUser()->getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testGetCurrentUserNotLoggedIn() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
|
||||
@@ -3216,7 +3231,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->assertSame($expected, $api->getUser('uid')->getData());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testResendWelcomeMessageWithNotExistingTargetUser() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(998);
|
||||
@@ -3230,7 +3245,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->resendWelcomeMessage('NotExistingUser');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testResendWelcomeMessageAsSubAdminAndUserIsNotAccessible() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionCode(997);
|
||||
@@ -3275,7 +3290,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->resendWelcomeMessage('UserToGet');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testResendWelcomeMessageNoEmail() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Email address not available');
|
||||
@@ -3316,7 +3331,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->resendWelcomeMessage('UserToGet');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testResendWelcomeMessageNullEmail() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Email address not available');
|
||||
@@ -3456,7 +3471,7 @@ class UsersControllerTest extends TestCase {
|
||||
$this->api->resendWelcomeMessage('UserToGet');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testResendWelcomeMessageFailed() {
|
||||
$this->expectException(\OCP\AppFramework\OCS\OCSException::class);
|
||||
$this->expectExceptionMessage('Sending email failed');
|
||||
|
||||
@@ -236,6 +236,7 @@ class UsersController extends Controller {
|
||||
$serverData['userCount'] = $userCount;
|
||||
$serverData['languages'] = $languages;
|
||||
$serverData['defaultLanguage'] = $this->config->getSystemValue('default_language', 'en');
|
||||
$serverData['forceLanguage'] = $this->config->getSystemValue('force_language', false);
|
||||
// Settings
|
||||
$serverData['defaultQuota'] = $defaultQuota;
|
||||
$serverData['canChangePassword'] = $canChangePassword;
|
||||
|
||||
@@ -195,7 +195,7 @@ Feature: sharing
|
||||
| share_type | 3 |
|
||||
| file_source | A_NUMBER |
|
||||
| file_target | /FOLDER |
|
||||
| permissions | 15 |
|
||||
| permissions | 31 |
|
||||
| stime | A_NUMBER |
|
||||
| token | A_TOKEN |
|
||||
| storage | A_NUMBER |
|
||||
@@ -259,7 +259,7 @@ Feature: sharing
|
||||
| share_type | 3 |
|
||||
| file_source | A_NUMBER |
|
||||
| file_target | /FOLDER |
|
||||
| permissions | 15 |
|
||||
| permissions | 31 |
|
||||
| stime | A_NUMBER |
|
||||
| token | A_TOKEN |
|
||||
| storage | A_NUMBER |
|
||||
|
||||
+1
-1
@@ -19,6 +19,6 @@
|
||||
"scripts": {
|
||||
"cs:fix": "php-cs-fixer fix",
|
||||
"cs:check": "php-cs-fixer fix --dry-run --diff",
|
||||
"lint": "find . -name \\*.php -not -path './lib/composer/*' -not -path './build/.phan/*' -exec php -l \"{}\" \\;"
|
||||
"lint": "find . -name \\*.php -not -path './lib/composer/*' -not -path './build/.phan/*' -print0 | xargs -0 -n1 php -l"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class OCJSController extends Controller {
|
||||
$iniWrapper,
|
||||
$urlGenerator,
|
||||
$capabilitiesManager,
|
||||
$initialStateService,
|
||||
$initialStateService
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ $color-yellow: #FC0;
|
||||
// rgb(118, 118, 118) / #767676
|
||||
// min. color contrast for normal text on white background according to WCAG AA
|
||||
// (Works as well: color: #000; opacity: 0.57;)
|
||||
$color-text-maxcontrast: nc-lighten($color-main-text, 46.2%) !default;
|
||||
$color-text-maxcontrast: nc-lighten($color-main-text, 33%) !default;
|
||||
$color-text-light: nc-lighten($color-main-text, 15%) !default;
|
||||
$color-text-lighter: nc-lighten($color-main-text, 30%) !default;
|
||||
|
||||
|
||||
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
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
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
@@ -787,11 +787,11 @@ const Dialogs = {
|
||||
|
||||
$conflict.find('.filename').text(original.name)
|
||||
$originalDiv.find('.size').text(OC.Util.humanFileSize(original.size))
|
||||
$originalDiv.find('.mtime').text(formatDate(original.mtime))
|
||||
$originalDiv.find('.mtime').text(OC.Util.formatDate(original.mtime))
|
||||
// ie sucks
|
||||
if (replacement.size && replacement.lastModifiedDate) {
|
||||
$replacementDiv.find('.size').text(OC.Util.humanFileSize(replacement.size))
|
||||
$replacementDiv.find('.mtime').text(formatDate(replacement.lastModifiedDate))
|
||||
$replacementDiv.find('.mtime').text(OC.Util.formatDate(replacement.lastModifiedDate))
|
||||
}
|
||||
var path = original.directory + '/' + original.name
|
||||
var urlSpec = {
|
||||
|
||||
@@ -82,11 +82,11 @@ const recommended = {
|
||||
spreed: {
|
||||
description: t('core', 'Chatting, video calls, screensharing, online meetings and web conferencing – in your browser and with mobile apps.'),
|
||||
},
|
||||
onlyoffice: {
|
||||
richdocuments: {
|
||||
description: t('core', 'Collaboratively edit office documents.'),
|
||||
},
|
||||
documentserver_community: {
|
||||
description: t('core', 'Local document editing back-end used by the OnlyOffice app.'),
|
||||
richdocumentscode: {
|
||||
description: t('core', 'Local document editing back-end used by the Collabora Online app.'),
|
||||
},
|
||||
}
|
||||
const recommendedIds = Object.keys(recommended)
|
||||
|
||||
@@ -166,7 +166,7 @@ script('core', [
|
||||
<input type="checkbox" id="install-recommended-apps" name="install-recommended-apps" class="checkbox checkbox--white" checked>
|
||||
<label for="install-recommended-apps">
|
||||
<?php p($l->t('Install recommended apps')); ?>
|
||||
<span><?php p($l->t('Calendar, Contacts, Talk, Mail & OnlyOffice')); ?></span>
|
||||
<span><?php p($l->t('Calendar, Contacts, Talk, Mail & Collaborative editing')); ?></span>
|
||||
</label>
|
||||
</p>
|
||||
</fieldset>
|
||||
|
||||
@@ -37,8 +37,8 @@ class HubBundle extends Bundle {
|
||||
'contacts',
|
||||
'calendar',
|
||||
'mail',
|
||||
'documentserver_community',
|
||||
'onlyoffice',
|
||||
'richdocumentscode',
|
||||
'richdocuments',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ use OCP\IConfig;
|
||||
use OCP\ILogger;
|
||||
|
||||
abstract class Fetcher {
|
||||
public const INVALIDATE_AFTER_SECONDS = 300;
|
||||
public const INVALIDATE_AFTER_SECONDS = 3600;
|
||||
|
||||
/** @var IAppData */
|
||||
protected $appData;
|
||||
@@ -98,12 +98,11 @@ abstract class Fetcher {
|
||||
|
||||
$options = [
|
||||
'timeout' => 10,
|
||||
'headers' => ['Accept-Encoding' => 'gzip'],
|
||||
];
|
||||
|
||||
if ($ETag !== '') {
|
||||
$options['headers'] = [
|
||||
'If-None-Match' => $ETag,
|
||||
];
|
||||
$options['headers']['If-None-Match'] = $ETag;
|
||||
}
|
||||
|
||||
$client = $this->clientService->newClient();
|
||||
@@ -153,7 +152,7 @@ abstract class Fetcher {
|
||||
// No caching when the version has been updated
|
||||
if (isset($jsonBlob['ncversion']) && $jsonBlob['ncversion'] === $this->getVersion()) {
|
||||
|
||||
// If the timestamp is older than 300 seconds request the files new
|
||||
// If the timestamp is older than 3600 seconds request the files new
|
||||
if ((int)$jsonBlob['timestamp'] > ($this->timeFactory->getTime() - self::INVALIDATE_AFTER_SECONDS)) {
|
||||
return $jsonBlob['data'];
|
||||
}
|
||||
|
||||
@@ -71,7 +71,9 @@ class CredentialRepository implements PublicKeyCredentialSourceRepository {
|
||||
} catch (IMapperException $e) {
|
||||
}
|
||||
|
||||
$defaultName = false;
|
||||
if ($name === null) {
|
||||
$defaultName = true;
|
||||
$name = 'default';
|
||||
}
|
||||
|
||||
@@ -79,7 +81,7 @@ class CredentialRepository implements PublicKeyCredentialSourceRepository {
|
||||
|
||||
if ($oldEntity) {
|
||||
$entity->setId($oldEntity->getId());
|
||||
if ($name === null) {
|
||||
if ($defaultName) {
|
||||
$entity->setName($oldEntity->getName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ class Factory implements IFactory {
|
||||
if ($this->languageExists($app, $locale)) {
|
||||
return $locale;
|
||||
}
|
||||
|
||||
|
||||
// Try to split e.g: fr_FR => fr
|
||||
$locale = explode('_', $locale)[0];
|
||||
if ($this->languageExists($app, $locale)) {
|
||||
@@ -585,7 +585,16 @@ class Factory implements IFactory {
|
||||
public function getLanguages() {
|
||||
$forceLanguage = $this->config->getSystemValue('force_language', false);
|
||||
if ($forceLanguage !== false) {
|
||||
return [];
|
||||
$l = $this->get('lib', $forceLanguage);
|
||||
$potentialName = (string) $l->t('__language_name__');
|
||||
|
||||
return [
|
||||
'commonlanguages' => [[
|
||||
'code' => $forceLanguage,
|
||||
'name' => $potentialName,
|
||||
]],
|
||||
'languages' => [],
|
||||
];
|
||||
}
|
||||
|
||||
$languageCodes = $this->findAvailableLanguages();
|
||||
|
||||
@@ -52,17 +52,14 @@ class Crypto implements ICrypto {
|
||||
private $ivLength = 16;
|
||||
/** @var IConfig */
|
||||
private $config;
|
||||
/** @var ISecureRandom */
|
||||
private $random;
|
||||
|
||||
/**
|
||||
* @param IConfig $config
|
||||
* @param ISecureRandom $random
|
||||
*/
|
||||
public function __construct(IConfig $config, ISecureRandom $random) {
|
||||
public function __construct(IConfig $config) {
|
||||
$this->cipher = new AES();
|
||||
$this->config = $config;
|
||||
$this->random = $random;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -95,13 +92,14 @@ class Crypto implements ICrypto {
|
||||
}
|
||||
$this->cipher->setPassword($password);
|
||||
|
||||
$iv = $this->random->generate($this->ivLength);
|
||||
$iv = \random_bytes($this->ivLength);
|
||||
$this->cipher->setIV($iv);
|
||||
|
||||
$ciphertext = bin2hex($this->cipher->encrypt($plaintext));
|
||||
$iv = bin2hex($iv);
|
||||
$hmac = bin2hex($this->calculateHMAC($ciphertext.$iv, $password));
|
||||
|
||||
return $ciphertext.'|'.$iv.'|'.$hmac;
|
||||
return $ciphertext.'|'.$iv.'|'.$hmac.'|2';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +117,8 @@ class Crypto implements ICrypto {
|
||||
$this->cipher->setPassword($password);
|
||||
|
||||
$parts = explode('|', $authenticatedCiphertext);
|
||||
if (\count($parts) !== 3) {
|
||||
$partCount = \count($parts);
|
||||
if ($partCount < 3 || $partCount > 4) {
|
||||
throw new \Exception('Authenticated ciphertext could not be decoded.');
|
||||
}
|
||||
|
||||
@@ -127,6 +126,13 @@ class Crypto implements ICrypto {
|
||||
$iv = $parts[1];
|
||||
$hmac = hex2bin($parts[2]);
|
||||
|
||||
if ($partCount === 4) {
|
||||
$version = $parts[3];
|
||||
if ($version === '2') {
|
||||
$iv = hex2bin($iv);
|
||||
}
|
||||
}
|
||||
|
||||
$this->cipher->setIV($iv);
|
||||
|
||||
if (!hash_equals($this->calculateHMAC($parts[0] . $parts[1], $password), $hmac)) {
|
||||
|
||||
@@ -543,6 +543,7 @@ class Setup {
|
||||
$content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocs-provider/";
|
||||
$content .= "\n RewriteCond %{REQUEST_FILENAME} !/ocm-provider/";
|
||||
$content .= "\n RewriteCond %{REQUEST_URI} !^/\\.well-known/(acme-challenge|pki-validation)/.*";
|
||||
$content .= "\n RewriteCond %{REQUEST_FILENAME} !/richdocumentscode/proxy.php$";
|
||||
$content .= "\n RewriteRule . index.php [PT,E=PATH_INFO:$1]";
|
||||
$content .= "\n RewriteBase " . $rewriteBase;
|
||||
$content .= "\n <IfModule mod_env.c>";
|
||||
|
||||
@@ -91,6 +91,14 @@ abstract class Controller {
|
||||
unset($headers['Content-Type']);
|
||||
}
|
||||
$response->setHeaders(array_merge($dataHeaders, $headers));
|
||||
|
||||
if ($data->getETag() !== null) {
|
||||
$response->setETag($data->getETag());
|
||||
}
|
||||
if ($data->getLastModified() !== null) {
|
||||
$response->setLastModified($data->getLastModified());
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
return new JSONResponse($data);
|
||||
|
||||
@@ -105,12 +105,11 @@ class Response {
|
||||
* @return $this
|
||||
* @since 6.0.0 - return value was added in 7.0.0
|
||||
*/
|
||||
public function cacheFor(int $cacheSeconds) {
|
||||
public function cacheFor(int $cacheSeconds, bool $public = false) {
|
||||
if ($cacheSeconds > 0) {
|
||||
$this->addHeader('Cache-Control', 'max-age=' . $cacheSeconds . ', must-revalidate');
|
||||
|
||||
// Old scool prama caching
|
||||
$this->addHeader('Pragma', 'public');
|
||||
$pragma = $public ? 'public' : 'private';
|
||||
$this->addHeader('Cache-Control', $pragma . ', max-age=' . $cacheSeconds . ', must-revalidate');
|
||||
$this->addHeader('Pragma', $pragma);
|
||||
|
||||
// Set expires header
|
||||
$expires = new \DateTime();
|
||||
|
||||
@@ -185,6 +185,12 @@ class Definitions {
|
||||
'description' => 'The type of the call: one2one, group or public',
|
||||
'example' => 'one2one',
|
||||
],
|
||||
'link' => [
|
||||
'since' => '19.0.0',
|
||||
'required' => false,
|
||||
'description' => 'The link to the conversation',
|
||||
'example' => 'https://localhost/index.php/call/R4nd0mToken',
|
||||
],
|
||||
],
|
||||
],
|
||||
'circle' => [
|
||||
|
||||
Generated
+3
-3
@@ -11089,9 +11089,9 @@
|
||||
}
|
||||
},
|
||||
"yargs-parser": {
|
||||
"version": "13.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.1.tgz",
|
||||
"integrity": "sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ==",
|
||||
"version": "13.1.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-13.1.2.tgz",
|
||||
"integrity": "sha512-3lbsNRf/j+A4QuSZfDRA7HRSfWrzO0YjqTJd5kjAq37Zep1CEgaYmrH9Q3GwPiB9cHyd1Y1UwggGhJGoxipbzg==",
|
||||
"requires": {
|
||||
"camelcase": "^5.0.0",
|
||||
"decamelize": "^1.2.0"
|
||||
|
||||
@@ -911,10 +911,6 @@
|
||||
"code": "en_US",
|
||||
"name": "English (United States)"
|
||||
},
|
||||
{
|
||||
"code": "en_US_POSIX",
|
||||
"name": "English (United States, Computer)"
|
||||
},
|
||||
{
|
||||
"code": "en_VC",
|
||||
"name": "English (St. Vincent & Grenadines)"
|
||||
@@ -1399,6 +1395,10 @@
|
||||
"code": "ga",
|
||||
"name": "Irish"
|
||||
},
|
||||
{
|
||||
"code": "ga_GB",
|
||||
"name": "Irish (United Kingdom)"
|
||||
},
|
||||
{
|
||||
"code": "ga_IE",
|
||||
"name": "Irish (Ireland)"
|
||||
|
||||
@@ -29,13 +29,21 @@ if (!extension_loaded('intl')) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$locales = array_map(function (string $localeCode) {
|
||||
require '../3rdparty/autoload.php';
|
||||
|
||||
$locales = array_map(static function (string $localeCode) {
|
||||
return [
|
||||
'code' => $localeCode,
|
||||
'name' => Locale::getDisplayName($localeCode, 'en')
|
||||
];
|
||||
}, ResourceBundle::getLocales(''));
|
||||
|
||||
$locales = array_filter($locales, static function (array $locale) {
|
||||
return is_array(Punic\Data::explodeLocale($locale['code']));
|
||||
});
|
||||
|
||||
$locales = array_values($locales);
|
||||
|
||||
if (file_put_contents(__DIR__ . '/locales.json', json_encode($locales, JSON_PRETTY_PRINT)) === false) {
|
||||
echo 'Failed to update locales.json';
|
||||
exit(1);
|
||||
|
||||
@@ -239,7 +239,7 @@ abstract class FetcherBase extends TestCase {
|
||||
$this->timeFactory
|
||||
->expects($this->at(0))
|
||||
->method('getTime')
|
||||
->willReturn(1501);
|
||||
->willReturn(4801);
|
||||
$client = $this->createMock(IClient::class);
|
||||
$this->clientService
|
||||
->expects($this->once())
|
||||
@@ -249,7 +249,15 @@ abstract class FetcherBase extends TestCase {
|
||||
$client
|
||||
->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->endpoint)
|
||||
->with(
|
||||
$this->equalTo($this->endpoint),
|
||||
$this->equalTo([
|
||||
'timeout' => 10,
|
||||
'headers' => [
|
||||
'Accept-Encoding' => 'gzip',
|
||||
]
|
||||
])
|
||||
)
|
||||
->willReturn($response);
|
||||
$response
|
||||
->expects($this->once())
|
||||
@@ -342,7 +350,15 @@ abstract class FetcherBase extends TestCase {
|
||||
$client
|
||||
->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->endpoint)
|
||||
->with(
|
||||
$this->equalTo($this->endpoint),
|
||||
$this->equalTo([
|
||||
'timeout' => 10,
|
||||
'headers' => [
|
||||
'Accept-Encoding' => 'gzip',
|
||||
]
|
||||
])
|
||||
)
|
||||
->willReturn($response);
|
||||
$response
|
||||
->expects($this->once())
|
||||
@@ -430,7 +446,15 @@ abstract class FetcherBase extends TestCase {
|
||||
$client
|
||||
->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->endpoint)
|
||||
->with(
|
||||
$this->equalTo($this->endpoint),
|
||||
$this->equalTo([
|
||||
'timeout' => 10,
|
||||
'headers' => [
|
||||
'Accept-Encoding' => 'gzip',
|
||||
]
|
||||
])
|
||||
)
|
||||
->willReturn($response);
|
||||
$response
|
||||
->expects($this->once())
|
||||
@@ -495,7 +519,15 @@ abstract class FetcherBase extends TestCase {
|
||||
$client
|
||||
->expects($this->once())
|
||||
->method('get')
|
||||
->with($this->endpoint)
|
||||
->with(
|
||||
$this->equalTo($this->endpoint),
|
||||
$this->equalTo([
|
||||
'timeout' => 10,
|
||||
'headers' => [
|
||||
'Accept-Encoding' => 'gzip',
|
||||
]
|
||||
])
|
||||
)
|
||||
->willThrowException(new \Exception());
|
||||
|
||||
$this->assertSame([], $this->fetcher->get());
|
||||
@@ -533,11 +565,11 @@ abstract class FetcherBase extends TestCase {
|
||||
$this->timeFactory
|
||||
->expects($this->at(0))
|
||||
->method('getTime')
|
||||
->willReturn(1501);
|
||||
->willReturn(4801);
|
||||
$this->timeFactory
|
||||
->expects($this->at(1))
|
||||
->method('getTime')
|
||||
->willReturn(1502);
|
||||
->willReturn(4802);
|
||||
$client = $this->createMock(IClient::class);
|
||||
$this->clientService
|
||||
->expects($this->once())
|
||||
@@ -552,14 +584,15 @@ abstract class FetcherBase extends TestCase {
|
||||
$this->equalTo([
|
||||
'timeout' => 10,
|
||||
'headers' => [
|
||||
'If-None-Match' => '"myETag"'
|
||||
'Accept-Encoding' => 'gzip',
|
||||
'If-None-Match' => '"myETag"',
|
||||
]
|
||||
])
|
||||
)->willReturn($response);
|
||||
$response->method('getStatusCode')
|
||||
->willReturn(304);
|
||||
|
||||
$newData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":1502,"ncversion":"11.0.0.2","ETag":"\"myETag\""}';
|
||||
$newData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":4802,"ncversion":"11.0.0.2","ETag":"\"myETag\""}';
|
||||
$file
|
||||
->expects($this->at(1))
|
||||
->method('putContent')
|
||||
@@ -624,6 +657,7 @@ abstract class FetcherBase extends TestCase {
|
||||
$this->equalTo([
|
||||
'timeout' => 10,
|
||||
'headers' => [
|
||||
'Accept-Encoding' => 'gzip',
|
||||
'If-None-Match' => '"myETag"',
|
||||
]
|
||||
])
|
||||
@@ -638,7 +672,7 @@ abstract class FetcherBase extends TestCase {
|
||||
$response->method('getHeader')
|
||||
->with($this->equalTo('ETag'))
|
||||
->willReturn('"newETag"');
|
||||
$fileData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":1502,"ncversion":"11.0.0.2","ETag":"\"newETag\""}';
|
||||
$fileData = '{"data":[{"id":"MyNewApp","foo":"foo"},{"id":"bar"}],"timestamp":4802,"ncversion":"11.0.0.2","ETag":"\"newETag\""}';
|
||||
$file
|
||||
->expects($this->at(1))
|
||||
->method('putContent')
|
||||
@@ -650,11 +684,11 @@ abstract class FetcherBase extends TestCase {
|
||||
$this->timeFactory
|
||||
->expects($this->at(0))
|
||||
->method('getTime')
|
||||
->willReturn(1501);
|
||||
->willReturn(4801);
|
||||
$this->timeFactory
|
||||
->expects($this->at(1))
|
||||
->method('getTime')
|
||||
->willReturn(1502);
|
||||
->willReturn(4802);
|
||||
|
||||
$expected = [
|
||||
[
|
||||
@@ -710,6 +744,9 @@ abstract class FetcherBase extends TestCase {
|
||||
$this->equalTo($this->endpoint),
|
||||
$this->equalTo([
|
||||
'timeout' => 10,
|
||||
'headers' => [
|
||||
'Accept-Encoding' => 'gzip',
|
||||
],
|
||||
])
|
||||
)
|
||||
->willReturn($response);
|
||||
|
||||
@@ -267,7 +267,7 @@ class ResponseTest extends \Test\TestCase {
|
||||
$this->assertEquals(Http::STATUS_NOT_FOUND, $this->childResponse->getStatus());
|
||||
$this->assertEquals('hi', $this->childResponse->getEtag());
|
||||
$this->assertEquals('Thu, 01 Jan 1970 00:00:01 +0000', $headers['Last-Modified']);
|
||||
$this->assertEquals('max-age=33, must-revalidate',
|
||||
$this->assertEquals('private, max-age=33, must-revalidate',
|
||||
$headers['Cache-Control']);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class CryptoTest extends \Test\TestCase {
|
||||
|
||||
protected function setUp(): void {
|
||||
parent::setUp();
|
||||
$this->crypto = new Crypto(\OC::$server->getConfig(), \OC::$server->getSecureRandom());
|
||||
$this->crypto = new Crypto(\OC::$server->getConfig());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +35,7 @@ class CryptoTest extends \Test\TestCase {
|
||||
$this->assertEquals($stringToEncrypt, $this->crypto->decrypt($ciphertext));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testWrongPassword() {
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('HMAC does not match.');
|
||||
@@ -51,7 +51,7 @@ class CryptoTest extends \Test\TestCase {
|
||||
$this->assertEquals($stringToEncrypt, $this->crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testWrongIV() {
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('HMAC does not match.');
|
||||
@@ -60,7 +60,7 @@ class CryptoTest extends \Test\TestCase {
|
||||
$this->crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd');
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function testWrongParameters() {
|
||||
$this->expectException(\Exception::class);
|
||||
$this->expectExceptionMessage('Authenticated ciphertext could not be decoded.');
|
||||
@@ -68,4 +68,11 @@ class CryptoTest extends \Test\TestCase {
|
||||
$encryptedString = '1|2';
|
||||
$this->crypto->decrypt($encryptedString, 'ThisIsAVeryS3cur3P4ssw0rd');
|
||||
}
|
||||
|
||||
public function testLegacy() {
|
||||
$cipherText = 'e16599188e3d212f5c7f17fdc2abca46|M1WfLAxbcAmITeD6|509457885d6ca5e6c3bfd3741852687a7f2bffce197f8d5ae97b65818b15a1b7f616b68326ff312371540f4ca8ac55f8e2de4aa13aab3474bd3431e51214e3ee';
|
||||
$password = 'mypass';
|
||||
|
||||
$this->assertSame('legacy test', $this->crypto->decrypt($cipherText, $password));
|
||||
}
|
||||
}
|
||||
|
||||
+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 = [19, 0, 0, 9];
|
||||
$OC_Version = [19, 0, 0, 12];
|
||||
|
||||
// The human readable string
|
||||
$OC_VersionString = '19.0.0 RC1';
|
||||
$OC_VersionString = '19.0.0';
|
||||
|
||||
$OC_VersionCanBeUpgradedFrom = [
|
||||
'nextcloud' => [
|
||||
|
||||
Reference in New Issue
Block a user