X Tutup
Skip to content

Commit 99d4057

Browse files
jnweigerphil-davis
authored andcommitted
Revert #40702 and #40712 for the 10.12.1 release, we want that in 10.13.0
1 parent 8ea5ae8 commit 99d4057

File tree

5 files changed

+61
-22
lines changed

5 files changed

+61
-22
lines changed

.drone.star

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ config = {
294294
"commands": [
295295
"php occ maintenance:singleuser --on",
296296
"php occ encryption:enable",
297+
"php occ encryption:select-encryption-type masterkey --yes",
297298
"php occ encryption:encrypt-all --yes",
298299
"php occ encryption:status",
299300
"php occ maintenance:singleuser --off",

core/Command/Encryption/EncryptAll.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,10 @@ protected function execute(InputInterface $input, OutputInterface $output) {
115115
$masterKeyEnabled = $this->config->getAppValue('encryption', 'useMasterKey', '');
116116
$userKeyEnabled = $this->config->getAppValue('encryption', 'userSpecificKey', '');
117117
if (($masterKeyEnabled === '') && ($userKeyEnabled === '')) {
118-
throw new \Exception('None of the encryption modules is enabled');
118+
/**
119+
* Enable user specific encryption if nothing is enabled.
120+
*/
121+
$this->config->setAppValue('encryption', 'userSpecificKey', '1');
119122
}
120123

121124
$output->writeln("\n");

tests/Core/Command/Encryption/EncryptAllTest.php

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ protected function setUp(): void {
7171
$this->consoleOutput = $this->createMock('Symfony\Component\Console\Output\OutputInterface');
7272
}
7373

74-
public function testSingleUserAndTrashbin() {
74+
public function testEncryptAll() {
7575
// trash bin needs to be disabled in order to avoid adding dummy files to the users
7676
// trash bin which gets deleted during the encryption process
7777
$this->appManager->expects($this->once())->method('disableApp')->with('files_trashbin');
@@ -99,11 +99,12 @@ public function testExecute($answer, $askResult) {
9999
$this->config->expects($this->any())
100100
->method('getAppValue')
101101
->willReturnMap([
102-
['encryption', 'useMasterKey', '', '1'], // enabled
102+
['encryption', 'useMasterKey', '', ''],
103103
['encryption', 'userSpecificKey', '', '']
104104
]);
105-
$this->config->expects($this->never())
106-
->method('setAppValue');
105+
$this->config->expects($this->once())
106+
->method('setAppValue')
107+
->willReturn(null);
107108

108109
if ($answer === 'Y' || $answer === 'y') {
109110
$this->encryptionManager->expects($this->once())
@@ -126,7 +127,7 @@ public function dataTestExecute() {
126127

127128
/**
128129
*/
129-
public function testExecuteEncryptionNotEnabled() {
130+
public function testExecuteException() {
130131
$this->expectException(\Exception::class);
131132

132133
$command = new EncryptAll($this->encryptionManager, $this->appManager, $this->config, $this->questionHelper);
@@ -135,20 +136,4 @@ public function testExecuteEncryptionNotEnabled() {
135136
$this->encryptionModule->expects($this->never())->method('encryptAll');
136137
$this->invokePrivate($command, 'execute', [$this->consoleInput, $this->consoleOutput]);
137138
}
138-
139-
/**
140-
*/
141-
public function testExecuteEncryptionModuleNotEnabled() {
142-
$this->expectException(\Exception::class);
143-
144-
$command = new EncryptAll($this->encryptionManager, $this->appManager, $this->config, $this->questionHelper);
145-
$this->encryptionManager->expects($this->once())->method('isEnabled')->willReturn(true);
146-
$this->config->expects($this->any())
147-
->method('getAppValue')
148-
->willReturnMap([
149-
['encryption', 'useMasterKey', '', ''],
150-
['encryption', 'userSpecificKey', '', '']
151-
]);
152-
$this->invokePrivate($command, 'execute', [$this->consoleInput, $this->consoleOutput]);
153-
}
154139
}

tests/acceptance/features/bootstrap/EncryptionContext.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,46 @@ public function encryptionHasBeenEnabled():void {
8484
$this->occContext->theCommandShouldHaveBeenSuccessful();
8585
}
8686

87+
/**
88+
* @param string $encryptionType
89+
*
90+
* @return void
91+
* @throws Exception
92+
*/
93+
public function setEncryptionTypeUsingTheOccCommand(string $encryptionType):int {
94+
return($this->featureContext->runOcc(
95+
["encryption:select-encryption-type", $encryptionType, "-y"]
96+
)
97+
);
98+
}
99+
100+
/**
101+
* @When the administrator sets the encryption type to :encryptionType using the occ command
102+
*
103+
* @param string $encryptionType
104+
*
105+
* @return void
106+
* @throws Exception
107+
*/
108+
public function theAdministratorSetsEncryptionTypeToUsingTheOccCommand(string $encryptionType):void {
109+
$this->featureContext->setOccLastCode(
110+
$this->setEncryptionTypeUsingTheOccCommand($encryptionType)
111+
);
112+
}
113+
114+
/**
115+
* @Given the administrator has set the encryption type to :encryptionType
116+
*
117+
* @param string $encryptionType
118+
*
119+
* @return void
120+
* @throws Exception
121+
*/
122+
public function theAdministratorHasSetEncryptionTypeToUsingTheOccCommand(string $encryptionType):void {
123+
$this->setEncryptionTypeUsingTheOccCommand($encryptionType);
124+
$this->occContext->theCommandShouldHaveBeenSuccessful();
125+
}
126+
87127
/**
88128
* @return void
89129
* @throws Exception

tests/acceptance/features/bootstrap/OccContext.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,16 @@ public function theAdministratorHasInvokedOccCommand(string $cmd):void {
668668
$this->theCommandShouldHaveBeenSuccessful();
669669
}
670670

671+
/**
672+
* @Given the administrator has selected master key encryption type using the occ command
673+
*
674+
* @return void
675+
* @throws Exception
676+
*/
677+
public function theAdministratorHasSelectedMasterKeyEncryptionTypeUsingTheOccCommand():void {
678+
$this->featureContext->runOcc(['encryption:select-encryption-type', "masterkey --yes"]);
679+
}
680+
671681
/**
672682
* @When the administrator imports security certificate from file :filename in temporary storage on the system under test
673683
*

0 commit comments

Comments
 (0)
X Tutup