![]()
-
+
![]()
diff --git a/settings/src/views/Users.vue b/settings/src/views/Users.vue
index 70b4db6641210..31770051a0d94 100644
--- a/settings/src/views/Users.vue
+++ b/settings/src/views/Users.vue
@@ -52,7 +52,7 @@
-
+
@@ -83,12 +83,24 @@ export default {
});
this.$store.dispatch('getPasswordPolicyMinLength');
},
+ created() {
+ // init the OCA.Settings.UserList object
+ // and add the registerAction method
+ Object.assign(OCA, {
+ Settings: {
+ UserList: {
+ registerAction: this.registerAction
+ }
+ }
+ });
+ },
data() {
return {
// default quota is set to unlimited
unlimitedQuota: {id: 'none', label: t('settings', 'Unlimited')},
// temporary value used for multiselect change
selectedQuota: false,
+ externalActions: [],
showConfig: {
showStoragePath: false,
showUserBackend: false,
@@ -171,6 +183,22 @@ export default {
// if no valid do not change
return false;
},
+
+ /**
+ * Register a new action for the user menu
+ *
+ * @param {string} icon the icon class
+ * @param {string} text the text to display
+ * @param {function} action the function to run
+ */
+ registerAction(icon, text, action) {
+ this.externalActions.push({
+ icon: icon,
+ text: text,
+ action: action
+ });
+ return this.externalActions;
+ }
},
computed: {
users() {
@@ -295,7 +323,7 @@ export default {
if (disabledGroup && disabledGroup.text) {
disabledGroup.text = t('settings', 'Disabled users'); // rename disabled group
disabledGroup.icon = 'icon-disabled-users'; // set icon
- if (disabledGroup.utils.counter === 0) {
+ if (!disabledGroup.utils.counter) {
groups.splice(disabledGroupIndex, 1); // remove disabled if empty
}
}
diff --git a/settings/templates/help.php b/settings/templates/help.php
index 3f042254f839b..4f25444881ea7 100644
--- a/settings/templates/help.php
+++ b/settings/templates/help.php
@@ -16,8 +16,8 @@
-
- t('Online documentation')); ?> ↗
+
+ t('Documentation')); ?> ↗
@@ -25,20 +25,6 @@
t('Forum')); ?> ↗
-
-
-
-
- t('Getting help')); ?> ↗
-
-
-
-
-
-
- t('Commercial support')); ?> ↗
-
-
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php
index 8ccabfbf79ab0..d6afa5959a068 100644
--- a/tests/Core/Controller/LostControllerTest.php
+++ b/tests/Core/Controller/LostControllerTest.php
@@ -27,6 +27,7 @@
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\Defaults;
+use OCP\Encryption\IEncryptionModule;
use OCP\Encryption\IManager;
use OCP\IConfig;
use OCP\IL10N;
@@ -713,10 +714,49 @@ public function testSendEmailNoEmail() {
$this->assertEquals($expectedResponse, $response);
}
- public function testSetPasswordEncryptionDontProceed() {
+ public function testSetPasswordEncryptionDontProceedPerUserKey() {
+ /** @var IEncryptionModule|PHPUnit_Framework_MockObject_MockObject $encryptionModule */
+ $encryptionModule = $this->createMock(IEncryptionModule::class);
+ $encryptionModule->expects($this->once())->method('needDetailedAccessList')->willReturn(true);
+ $this->encryptionManager->expects($this->once())->method('getEncryptionModules')
+ ->willReturn([0 => ['callback' => function() use ($encryptionModule) { return $encryptionModule; }]]);
$response = $this->lostController->setPassword('myToken', 'user', 'newpass', false);
$expectedResponse = ['status' => 'error', 'msg' => '', 'encryption' => true];
$this->assertSame($expectedResponse, $response);
}
+ public function testSetPasswordDontProceedMasterKey() {
+ $encryptionModule = $this->createMock(IEncryptionModule::class);
+ $encryptionModule->expects($this->once())->method('needDetailedAccessList')->willReturn(false);
+ $this->encryptionManager->expects($this->once())->method('getEncryptionModules')
+ ->willReturn([0 => ['callback' => function() use ($encryptionModule) { return $encryptionModule; }]]);
+ $this->config->method('getUserValue')
+ ->with('ValidTokenUser', 'core', 'lostpassword', null)
+ ->willReturn('encryptedData');
+ $this->existingUser->method('getLastLogin')
+ ->will($this->returnValue(12344));
+ $this->existingUser->expects($this->once())
+ ->method('setPassword')
+ ->with('NewPassword')
+ ->willReturn(true);
+ $this->userManager->method('get')
+ ->with('ValidTokenUser')
+ ->willReturn($this->existingUser);
+ $this->config->expects($this->once())
+ ->method('deleteUserValue')
+ ->with('ValidTokenUser', 'core', 'lostpassword');
+ $this->timeFactory->method('getTime')
+ ->will($this->returnValue(12348));
+
+ $this->crypto->method('decrypt')
+ ->with(
+ $this->equalTo('encryptedData'),
+ $this->equalTo('test@example.comSECRET')
+ )->willReturn('12345:TheOnlyAndOnlyOneTokenToResetThePassword');
+
+ $response = $this->lostController->setPassword('TheOnlyAndOnlyOneTokenToResetThePassword', 'ValidTokenUser', 'NewPassword', false);
+ $expectedResponse = array('user' => 'ValidTokenUser', 'status' => 'success');
+ $this->assertSame($expectedResponse, $response);
+ }
+
}
diff --git a/tests/Settings/Controller/CheckSetupControllerTest.php b/tests/Settings/Controller/CheckSetupControllerTest.php
index 305e2ba22ce30..a7689eed801f6 100644
--- a/tests/Settings/Controller/CheckSetupControllerTest.php
+++ b/tests/Settings/Controller/CheckSetupControllerTest.php
@@ -22,6 +22,7 @@
namespace Tests\Settings\Controller;
use OC\DB\Connection;
+use OC\MemoryInfo;
use OC\Settings\Controller\CheckSetupController;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataDisplayResponse;
@@ -36,6 +37,7 @@
use OCP\IURLGenerator;
use OC_Util;
use OCP\Lock\ILockingProvider;
+use PHPUnit\Framework\MockObject\MockObject;
use Psr\Http\Message\ResponseInterface;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Test\TestCase;
@@ -73,6 +75,8 @@ class CheckSetupControllerTest extends TestCase {
private $lockingProvider;
/** @var IDateTimeFormatter|\PHPUnit_Framework_MockObject_MockObject */
private $dateTimeFormatter;
+ /** @var MemoryInfo|MockObject */
+ private $memoryInfo;
public function setUp() {
parent::setUp();
@@ -103,6 +107,9 @@ public function setUp() {
->disableOriginalConstructor()->getMock();
$this->lockingProvider = $this->getMockBuilder(ILockingProvider::class)->getMock();
$this->dateTimeFormatter = $this->getMockBuilder(IDateTimeFormatter::class)->getMock();
+ $this->memoryInfo = $this->getMockBuilder(MemoryInfo::class)
+ ->setMethods(['isMemoryLimitSufficient',])
+ ->getMock();
$this->checkSetupController = $this->getMockBuilder('\OC\Settings\Controller\CheckSetupController')
->setConstructorArgs([
'settings',
@@ -118,6 +125,7 @@ public function setUp() {
$this->db,
$this->lockingProvider,
$this->dateTimeFormatter,
+ $this->memoryInfo,
])
->setMethods([
'isReadOnlyConfig',
@@ -424,6 +432,9 @@ public function testCheck() {
->expects($this->once())
->method('hasPassedCheck')
->willReturn(true);
+ $this->memoryInfo
+ ->method('isMemoryLimitSufficient')
+ ->willReturn(true);
$expected = new DataResponse(
[
@@ -465,6 +476,7 @@ public function testCheck() {
'missingIndexes' => [],
'isPhpMailerUsed' => false,
'mailSettingsDocumentation' => 'https://server/index.php/settings/admin',
+ 'isMemoryLimitSufficient' => true,
]
);
$this->assertEquals($expected, $this->checkSetupController->check());
@@ -486,6 +498,7 @@ public function testGetCurlVersion() {
$this->db,
$this->lockingProvider,
$this->dateTimeFormatter,
+ $this->memoryInfo,
])
->setMethods(null)->getMock();
diff --git a/tests/acceptance/features/users.feature b/tests/acceptance/features/users.feature
index 6baf306363111..b5a22cd39405a 100644
--- a/tests/acceptance/features/users.feature
+++ b/tests/acceptance/features/users.feature
@@ -43,6 +43,20 @@ Feature: users
When I open the "Disabled users" section
Then I see that the list of users contains the user user0
+ Scenario: users navigation without disabled users
+ Given I act as Jane
+ And I am logged in as the admin
+ And I open the User settings
+ And I open the "Disabled users" section
+ And I see that the list of users contains the user disabledUser
+ And I open the actions menu for the user disabledUser
+ And I see that the "Enable user" action in the disabledUser actions menu is shown
+ When I click the "Enable user" action in the disabledUser actions menu
+ Then I see that the section "Disabled users" is not shown
+ # check again after reloading the settings
+ When I open the User settings
+ Then I see that the section "Disabled users" is not shown
+
Scenario: assign user to a group
Given I act as Jane
And I am logged in as the admin
diff --git a/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php b/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php
index e75486b3ed5ea..b3182ff00c84e 100644
--- a/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php
+++ b/tests/lib/App/AppStore/Bundles/EnterpriseBundleTest.php
@@ -36,6 +36,7 @@ public function setUp() {
'files_automatedtagging',
'user_saml',
'files_accesscontrol',
+ 'terms_of_service',
];
}
}
diff --git a/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php b/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php
index f2f9dcc5ccc44..ccff5dcbd34cc 100644
--- a/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php
+++ b/tests/lib/App/AppStore/Bundles/GroupwareBundleTest.php
@@ -32,7 +32,8 @@ public function setUp() {
$this->bundleAppIds = [
'calendar',
'contacts',
- 'spreed',
+ 'deck',
+ 'mail'
];
}
}
diff --git a/tests/lib/Collaboration/Collaborators/UserPluginTest.php b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
index cfb97de867634..7513f9da5b67b 100644
--- a/tests/lib/Collaboration/Collaborators/UserPluginTest.php
+++ b/tests/lib/Collaboration/Collaborators/UserPluginTest.php
@@ -89,7 +89,7 @@ public function instantiatePlugin() {
);
}
- public function getUserMock($uid, $displayName) {
+ public function getUserMock($uid, $displayName, $enabled = true) {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@@ -100,6 +100,10 @@ public function getUserMock($uid, $displayName) {
->method('getDisplayName')
->willReturn($displayName);
+ $user->expects($this->any())
+ ->method('isEnabled')
+ ->willReturn($enabled);
+
return $user;
}
diff --git a/tests/lib/Memcache/XCacheTest.php b/tests/lib/Memcache/XCacheTest.php
deleted file mode 100644
index af720115d0141..0000000000000
--- a/tests/lib/Memcache/XCacheTest.php
+++ /dev/null
@@ -1,22 +0,0 @@
-
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
- */
-
-namespace Test\Memcache;
-
-class XCacheTest extends Cache {
- protected function setUp() {
- parent::setUp();
-
- if (!\OC\Memcache\XCache::isAvailable()) {
- $this->markTestSkipped('The xcache extension is not available.');
- return;
- }
- $this->instance = new \OC\Memcache\XCache($this->getUniqueID());
- }
-}
diff --git a/tests/lib/MemoryInfoTest.php b/tests/lib/MemoryInfoTest.php
new file mode 100644
index 0000000000000..057d3091b2cd2
--- /dev/null
+++ b/tests/lib/MemoryInfoTest.php
@@ -0,0 +1,97 @@
+iniSettingBeforeTest = ini_get('memory_limit');
+ }
+
+ /**
+ * @afterClass
+ */
+ public function restoreMemoryInfoIniSetting() {
+ ini_set('memory_limit', $this->iniSettingBeforeTest);
+ }
+
+ /**
+ * Provides test data.
+ *
+ * @return array
+ */
+ public function getMemoryLimitTestData(): array {
+ return [
+ 'unlimited' => ['-1', -1,],
+ '0' => ['0', 0,],
+ '134217728 bytes' => ['134217728', 134217728,],
+ '128M' => ['128M', 134217728,],
+ '131072K' => ['131072K', 134217728,],
+ '2G' => ['2G', 2147483648,],
+ ];
+ }
+
+ /**
+ * Tests that getMemoryLimit works as expected.
+ *
+ * @param string $iniValue The "memory_limit" ini data.
+ * @param int $expected The expected detected memory limit.
+ * @dataProvider getMemoryLimitTestData
+ */
+ public function testMemoryLimit($iniValue, int $expected) {
+ ini_set('memory_limit', $iniValue);
+ $memoryInfo = new MemoryInfo();
+ self::assertEquals($expected, $memoryInfo->getMemoryLimit());
+ }
+
+ /**
+ * Provides sufficient memory limit test data.
+ *
+ * @return array
+ */
+ public function getSufficientMemoryTestData(): array {
+ return [
+ 'unlimited' => [-1, true,],
+ '512M' => [512 * 1024 * 1024, true,],
+ '1G' => [1024 * 1024 * 1024, true,],
+ '256M' => [256 * 1024 * 1024, false,],
+ ];
+ }
+
+ /**
+ * Tests that isMemoryLimitSufficient returns the correct values.
+ *
+ * @param int $memoryLimit The memory limit
+ * @param bool $expected If the memory limit is sufficient.
+ * @dataProvider getSufficientMemoryTestData
+ * @return void
+ */
+ public function testIsMemoryLimitSufficient(int $memoryLimit, bool $expected) {
+ /* @var MemoryInfo|MockObject $memoryInfo */
+ $memoryInfo = $this->getMockBuilder(MemoryInfo::class)
+ ->setMethods(['getMemoryLimit',])
+ ->getMock();
+
+ $memoryInfo
+ ->method('getMemoryLimit')
+ ->willReturn($memoryLimit);
+
+ $isMemoryLimitSufficient = $memoryInfo->isMemoryLimitSufficient();
+ self::assertEquals($expected, $isMemoryLimitSufficient);
+ }
+}
diff --git a/tests/lib/Preview/GeneratorTest.php b/tests/lib/Preview/GeneratorTest.php
index b6200b1829b41..64786fa9fe8a4 100644
--- a/tests/lib/Preview/GeneratorTest.php
+++ b/tests/lib/Preview/GeneratorTest.php
@@ -150,16 +150,24 @@ public function testGetNewPreview() {
}));
$invalidProvider = $this->createMock(IProvider::class);
+ $invalidProvider->method('isAvailable')
+ ->willReturn(true);
+ $unavailableProvider = $this->createMock(IProvider::class);
+ $unavailableProvider->method('isAvailable')
+ ->willReturn(false);
$validProvider = $this->createMock(IProvider::class);
+ $validProvider->method('isAvailable')
+ ->with($file)
+ ->willReturn(true);
$this->previewManager->method('getProviders')
->willReturn([
'/image\/png/' => ['wrongProvider'],
- '/myMimeType/' => ['brokenProvider', 'invalidProvider', 'validProvider'],
+ '/myMimeType/' => ['brokenProvider', 'invalidProvider', 'unavailableProvider', 'validProvider'],
]);
$this->helper->method('getProvider')
- ->will($this->returnCallback(function($provider) use ($invalidProvider, $validProvider) {
+ ->will($this->returnCallback(function($provider) use ($invalidProvider, $validProvider, $unavailableProvider) {
if ($provider === 'wrongProvider') {
$this->fail('Wrongprovider should not be constructed!');
} else if ($provider === 'brokenProvider') {
@@ -168,6 +176,8 @@ public function testGetNewPreview() {
return $invalidProvider;
} else if ($provider === 'validProvider') {
return $validProvider;
+ } else if ($provider === 'unavailableProvider') {
+ return $unavailableProvider;
}
$this->fail('Unexpected provider requested');
}));
diff --git a/version.php b/version.php
index 4146fb97ccdff..d82cd524e46c6 100644
--- a/version.php
+++ b/version.php
@@ -29,10 +29,10 @@
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
// when updating major/minor version number.
-$OC_Version = array(14, 0, 0, 15);
+$OC_Version = array(14, 0, 0, 16);
// The human readable string
-$OC_VersionString = '14.0.0 Beta 3';
+$OC_VersionString = '14.0.0 Beta 4';
$OC_VersionCanBeUpgradedFrom = [
'nextcloud' => [