@@ -30,15 +30,15 @@ |
||
30 | 30 | use OCP\EventDispatcher\IEventListener; |
31 | 31 | |
32 | 32 | class CommentsEntityEventListener implements IEventListener { |
33 | - public function handle(Event $event): void { |
|
34 | - if (!($event instanceof CommentsEntityEvent)) { |
|
35 | - // Unrelated |
|
36 | - return; |
|
37 | - } |
|
33 | + public function handle(Event $event): void { |
|
34 | + if (!($event instanceof CommentsEntityEvent)) { |
|
35 | + // Unrelated |
|
36 | + return; |
|
37 | + } |
|
38 | 38 | |
39 | - $event->addEntityCollection('files', function ($name) { |
|
40 | - $nodes = \OC::$server->getUserFolder()->getById((int)$name); |
|
41 | - return !empty($nodes); |
|
42 | - }); |
|
43 | - } |
|
39 | + $event->addEntityCollection('files', function ($name) { |
|
40 | + $nodes = \OC::$server->getUserFolder()->getById((int)$name); |
|
41 | + return !empty($nodes); |
|
42 | + }); |
|
43 | + } |
|
44 | 44 | } |
@@ -38,81 +38,81 @@ |
||
38 | 38 | use Webauthn\PublicKeyCredentialCreationOptions; |
39 | 39 | |
40 | 40 | class WebAuthnController extends Controller { |
41 | - private const WEBAUTHN_REGISTRATION = 'webauthn_registration'; |
|
42 | - |
|
43 | - /** @var Manager */ |
|
44 | - private $manager; |
|
45 | - |
|
46 | - /** @var IUserSession */ |
|
47 | - private $userSession; |
|
48 | - /** |
|
49 | - * @var ISession |
|
50 | - */ |
|
51 | - private $session; |
|
52 | - /** |
|
53 | - * @var ILogger |
|
54 | - */ |
|
55 | - private $logger; |
|
56 | - |
|
57 | - public function __construct(IRequest $request, ILogger $logger, Manager $webAuthnManager, IUserSession $userSession, ISession $session) { |
|
58 | - parent::__construct(Application::APP_ID, $request); |
|
59 | - |
|
60 | - $this->manager = $webAuthnManager; |
|
61 | - $this->userSession = $userSession; |
|
62 | - $this->session = $session; |
|
63 | - $this->logger = $logger; |
|
64 | - } |
|
65 | - |
|
66 | - /** |
|
67 | - * @NoAdminRequired |
|
68 | - * @NoSubAdminRequired |
|
69 | - * @PasswordConfirmationRequired |
|
70 | - * @UseSession |
|
71 | - * @NoCSRFRequired |
|
72 | - */ |
|
73 | - public function startRegistration(): JSONResponse { |
|
74 | - $this->logger->debug('Starting WebAuthn registration'); |
|
75 | - |
|
76 | - $credentialOptions = $this->manager->startRegistration($this->userSession->getUser(), $this->request->getServerHost()); |
|
77 | - |
|
78 | - // Set this in the session since we need it on finish |
|
79 | - $this->session->set(self::WEBAUTHN_REGISTRATION, $credentialOptions); |
|
80 | - |
|
81 | - return new JSONResponse($credentialOptions); |
|
82 | - } |
|
83 | - |
|
84 | - /** |
|
85 | - * @NoAdminRequired |
|
86 | - * @NoSubAdminRequired |
|
87 | - * @PasswordConfirmationRequired |
|
88 | - * @UseSession |
|
89 | - */ |
|
90 | - public function finishRegistration(string $name, string $data): JSONResponse { |
|
91 | - $this->logger->debug('Finishing WebAuthn registration'); |
|
92 | - |
|
93 | - if (!$this->session->exists(self::WEBAUTHN_REGISTRATION)) { |
|
94 | - $this->logger->debug('Trying to finish WebAuthn registration without session data'); |
|
95 | - return new JSONResponse([], Http::STATUS_BAD_REQUEST); |
|
96 | - } |
|
97 | - |
|
98 | - // Obtain the publicKeyCredentialOptions from when we started the registration |
|
99 | - $publicKeyCredentialCreationOptions = PublicKeyCredentialCreationOptions::createFromArray($this->session->get(self::WEBAUTHN_REGISTRATION)); |
|
100 | - |
|
101 | - $this->session->remove(self::WEBAUTHN_REGISTRATION); |
|
102 | - |
|
103 | - return new JSONResponse($this->manager->finishRegister($publicKeyCredentialCreationOptions, $name, $data)); |
|
104 | - } |
|
105 | - |
|
106 | - /** |
|
107 | - * @NoAdminRequired |
|
108 | - * @NoSubAdminRequired |
|
109 | - * @PasswordConfirmationRequired |
|
110 | - */ |
|
111 | - public function deleteRegistration(int $id): JSONResponse { |
|
112 | - $this->logger->debug('Finishing WebAuthn registration'); |
|
113 | - |
|
114 | - $this->manager->deleteRegistration($this->userSession->getUser(), $id); |
|
115 | - |
|
116 | - return new JSONResponse([]); |
|
117 | - } |
|
41 | + private const WEBAUTHN_REGISTRATION = 'webauthn_registration'; |
|
42 | + |
|
43 | + /** @var Manager */ |
|
44 | + private $manager; |
|
45 | + |
|
46 | + /** @var IUserSession */ |
|
47 | + private $userSession; |
|
48 | + /** |
|
49 | + * @var ISession |
|
50 | + */ |
|
51 | + private $session; |
|
52 | + /** |
|
53 | + * @var ILogger |
|
54 | + */ |
|
55 | + private $logger; |
|
56 | + |
|
57 | + public function __construct(IRequest $request, ILogger $logger, Manager $webAuthnManager, IUserSession $userSession, ISession $session) { |
|
58 | + parent::__construct(Application::APP_ID, $request); |
|
59 | + |
|
60 | + $this->manager = $webAuthnManager; |
|
61 | + $this->userSession = $userSession; |
|
62 | + $this->session = $session; |
|
63 | + $this->logger = $logger; |
|
64 | + } |
|
65 | + |
|
66 | + /** |
|
67 | + * @NoAdminRequired |
|
68 | + * @NoSubAdminRequired |
|
69 | + * @PasswordConfirmationRequired |
|
70 | + * @UseSession |
|
71 | + * @NoCSRFRequired |
|
72 | + */ |
|
73 | + public function startRegistration(): JSONResponse { |
|
74 | + $this->logger->debug('Starting WebAuthn registration'); |
|
75 | + |
|
76 | + $credentialOptions = $this->manager->startRegistration($this->userSession->getUser(), $this->request->getServerHost()); |
|
77 | + |
|
78 | + // Set this in the session since we need it on finish |
|
79 | + $this->session->set(self::WEBAUTHN_REGISTRATION, $credentialOptions); |
|
80 | + |
|
81 | + return new JSONResponse($credentialOptions); |
|
82 | + } |
|
83 | + |
|
84 | + /** |
|
85 | + * @NoAdminRequired |
|
86 | + * @NoSubAdminRequired |
|
87 | + * @PasswordConfirmationRequired |
|
88 | + * @UseSession |
|
89 | + */ |
|
90 | + public function finishRegistration(string $name, string $data): JSONResponse { |
|
91 | + $this->logger->debug('Finishing WebAuthn registration'); |
|
92 | + |
|
93 | + if (!$this->session->exists(self::WEBAUTHN_REGISTRATION)) { |
|
94 | + $this->logger->debug('Trying to finish WebAuthn registration without session data'); |
|
95 | + return new JSONResponse([], Http::STATUS_BAD_REQUEST); |
|
96 | + } |
|
97 | + |
|
98 | + // Obtain the publicKeyCredentialOptions from when we started the registration |
|
99 | + $publicKeyCredentialCreationOptions = PublicKeyCredentialCreationOptions::createFromArray($this->session->get(self::WEBAUTHN_REGISTRATION)); |
|
100 | + |
|
101 | + $this->session->remove(self::WEBAUTHN_REGISTRATION); |
|
102 | + |
|
103 | + return new JSONResponse($this->manager->finishRegister($publicKeyCredentialCreationOptions, $name, $data)); |
|
104 | + } |
|
105 | + |
|
106 | + /** |
|
107 | + * @NoAdminRequired |
|
108 | + * @NoSubAdminRequired |
|
109 | + * @PasswordConfirmationRequired |
|
110 | + */ |
|
111 | + public function deleteRegistration(int $id): JSONResponse { |
|
112 | + $this->logger->debug('Finishing WebAuthn registration'); |
|
113 | + |
|
114 | + $this->manager->deleteRegistration($this->userSession->getUser(), $id); |
|
115 | + |
|
116 | + return new JSONResponse([]); |
|
117 | + } |
|
118 | 118 | } |
@@ -32,101 +32,101 @@ |
||
32 | 32 | * @deprecated 20.0.0 |
33 | 33 | */ |
34 | 34 | class Result extends BaseResult { |
35 | - /** |
|
36 | - * @deprecated 20.0.0 |
|
37 | - */ |
|
38 | - public $type = 'comment'; |
|
39 | - /** |
|
40 | - * @deprecated 20.0.0 |
|
41 | - */ |
|
42 | - public $comment; |
|
43 | - /** |
|
44 | - * @deprecated 20.0.0 |
|
45 | - */ |
|
46 | - public $authorId; |
|
47 | - /** |
|
48 | - * @deprecated 20.0.0 |
|
49 | - */ |
|
50 | - public $authorName; |
|
51 | - /** |
|
52 | - * @deprecated 20.0.0 |
|
53 | - */ |
|
54 | - public $path; |
|
55 | - /** |
|
56 | - * @deprecated 20.0.0 |
|
57 | - */ |
|
58 | - public $fileName; |
|
35 | + /** |
|
36 | + * @deprecated 20.0.0 |
|
37 | + */ |
|
38 | + public $type = 'comment'; |
|
39 | + /** |
|
40 | + * @deprecated 20.0.0 |
|
41 | + */ |
|
42 | + public $comment; |
|
43 | + /** |
|
44 | + * @deprecated 20.0.0 |
|
45 | + */ |
|
46 | + public $authorId; |
|
47 | + /** |
|
48 | + * @deprecated 20.0.0 |
|
49 | + */ |
|
50 | + public $authorName; |
|
51 | + /** |
|
52 | + * @deprecated 20.0.0 |
|
53 | + */ |
|
54 | + public $path; |
|
55 | + /** |
|
56 | + * @deprecated 20.0.0 |
|
57 | + */ |
|
58 | + public $fileName; |
|
59 | 59 | |
60 | - /** |
|
61 | - * @param string $search |
|
62 | - * @param IComment $comment |
|
63 | - * @param string $authorName |
|
64 | - * @param string $path |
|
65 | - * @throws NotFoundException |
|
66 | - * @deprecated 20.0.0 |
|
67 | - */ |
|
68 | - public function __construct(string $search, |
|
69 | - IComment $comment, |
|
70 | - string $authorName, |
|
71 | - string $path) { |
|
72 | - parent::__construct( |
|
73 | - (int) $comment->getId(), |
|
74 | - $comment->getMessage() |
|
75 | - /* @todo , [link to file] */ |
|
76 | - ); |
|
60 | + /** |
|
61 | + * @param string $search |
|
62 | + * @param IComment $comment |
|
63 | + * @param string $authorName |
|
64 | + * @param string $path |
|
65 | + * @throws NotFoundException |
|
66 | + * @deprecated 20.0.0 |
|
67 | + */ |
|
68 | + public function __construct(string $search, |
|
69 | + IComment $comment, |
|
70 | + string $authorName, |
|
71 | + string $path) { |
|
72 | + parent::__construct( |
|
73 | + (int) $comment->getId(), |
|
74 | + $comment->getMessage() |
|
75 | + /* @todo , [link to file] */ |
|
76 | + ); |
|
77 | 77 | |
78 | - $this->comment = $this->getRelevantMessagePart($comment->getMessage(), $search); |
|
79 | - $this->authorId = $comment->getActorId(); |
|
80 | - $this->authorName = $authorName; |
|
81 | - $this->fileName = basename($path); |
|
82 | - $this->path = $this->getVisiblePath($path); |
|
83 | - } |
|
78 | + $this->comment = $this->getRelevantMessagePart($comment->getMessage(), $search); |
|
79 | + $this->authorId = $comment->getActorId(); |
|
80 | + $this->authorName = $authorName; |
|
81 | + $this->fileName = basename($path); |
|
82 | + $this->path = $this->getVisiblePath($path); |
|
83 | + } |
|
84 | 84 | |
85 | - /** |
|
86 | - * @param string $path |
|
87 | - * @return string |
|
88 | - * @throws NotFoundException |
|
89 | - */ |
|
90 | - protected function getVisiblePath(string $path): string { |
|
91 | - $segments = explode('/', trim($path, '/'), 3); |
|
85 | + /** |
|
86 | + * @param string $path |
|
87 | + * @return string |
|
88 | + * @throws NotFoundException |
|
89 | + */ |
|
90 | + protected function getVisiblePath(string $path): string { |
|
91 | + $segments = explode('/', trim($path, '/'), 3); |
|
92 | 92 | |
93 | - if (!isset($segments[2])) { |
|
94 | - throw new NotFoundException('Path not inside visible section'); |
|
95 | - } |
|
93 | + if (!isset($segments[2])) { |
|
94 | + throw new NotFoundException('Path not inside visible section'); |
|
95 | + } |
|
96 | 96 | |
97 | - return $segments[2]; |
|
98 | - } |
|
97 | + return $segments[2]; |
|
98 | + } |
|
99 | 99 | |
100 | - /** |
|
101 | - * @param string $message |
|
102 | - * @param string $search |
|
103 | - * @return string |
|
104 | - * @throws NotFoundException |
|
105 | - */ |
|
106 | - protected function getRelevantMessagePart(string $message, string $search): string { |
|
107 | - $start = mb_stripos($message, $search); |
|
108 | - if ($start === false) { |
|
109 | - throw new NotFoundException('Comment section not found'); |
|
110 | - } |
|
100 | + /** |
|
101 | + * @param string $message |
|
102 | + * @param string $search |
|
103 | + * @return string |
|
104 | + * @throws NotFoundException |
|
105 | + */ |
|
106 | + protected function getRelevantMessagePart(string $message, string $search): string { |
|
107 | + $start = mb_stripos($message, $search); |
|
108 | + if ($start === false) { |
|
109 | + throw new NotFoundException('Comment section not found'); |
|
110 | + } |
|
111 | 111 | |
112 | - $end = $start + mb_strlen($search); |
|
112 | + $end = $start + mb_strlen($search); |
|
113 | 113 | |
114 | - if ($start <= 25) { |
|
115 | - $start = 0; |
|
116 | - $prefix = ''; |
|
117 | - } else { |
|
118 | - $start -= 25; |
|
119 | - $prefix = '…'; |
|
120 | - } |
|
114 | + if ($start <= 25) { |
|
115 | + $start = 0; |
|
116 | + $prefix = ''; |
|
117 | + } else { |
|
118 | + $start -= 25; |
|
119 | + $prefix = '…'; |
|
120 | + } |
|
121 | 121 | |
122 | - if ((mb_strlen($message) - $end) <= 25) { |
|
123 | - $end = mb_strlen($message); |
|
124 | - $suffix = ''; |
|
125 | - } else { |
|
126 | - $end += 25; |
|
127 | - $suffix = '…'; |
|
128 | - } |
|
122 | + if ((mb_strlen($message) - $end) <= 25) { |
|
123 | + $end = mb_strlen($message); |
|
124 | + $suffix = ''; |
|
125 | + } else { |
|
126 | + $end += 25; |
|
127 | + $suffix = '…'; |
|
128 | + } |
|
129 | 129 | |
130 | - return $prefix . mb_substr($message, $start, $end - $start) . $suffix; |
|
131 | - } |
|
130 | + return $prefix . mb_substr($message, $start, $end - $start) . $suffix; |
|
131 | + } |
|
132 | 132 | } |
@@ -27,331 +27,331 @@ |
||
27 | 27 | use OCP\Share\IShare; |
28 | 28 | |
29 | 29 | class CloudFederationShare implements ICloudFederationShare { |
30 | - private $share = [ |
|
31 | - 'shareWith' => '', |
|
32 | - 'shareType' => '', |
|
33 | - 'name' => '', |
|
34 | - 'resourceType' => '', |
|
35 | - 'description' => '', |
|
36 | - 'providerId' => '', |
|
37 | - 'owner' => '', |
|
38 | - 'ownerDisplayName' => '', |
|
39 | - 'sharedBy' => '', |
|
40 | - 'sharedByDisplayName' => '', |
|
41 | - 'protocol' => [] |
|
42 | - ]; |
|
30 | + private $share = [ |
|
31 | + 'shareWith' => '', |
|
32 | + 'shareType' => '', |
|
33 | + 'name' => '', |
|
34 | + 'resourceType' => '', |
|
35 | + 'description' => '', |
|
36 | + 'providerId' => '', |
|
37 | + 'owner' => '', |
|
38 | + 'ownerDisplayName' => '', |
|
39 | + 'sharedBy' => '', |
|
40 | + 'sharedByDisplayName' => '', |
|
41 | + 'protocol' => [] |
|
42 | + ]; |
|
43 | 43 | |
44 | - /** |
|
45 | - * get a CloudFederationShare Object to prepare a share you want to send |
|
46 | - * |
|
47 | - * @param string $shareWith |
|
48 | - * @param string $name resource name (e.g. document.odt) |
|
49 | - * @param string $description share description (optional) |
|
50 | - * @param string $providerId resource UID on the provider side |
|
51 | - * @param string $owner provider specific UID of the user who owns the resource |
|
52 | - * @param string $ownerDisplayName display name of the user who shared the item |
|
53 | - * @param string $sharedBy provider specific UID of the user who shared the resource |
|
54 | - * @param string $sharedByDisplayName display name of the user who shared the resource |
|
55 | - * @param string $shareType ('group' or 'user' share) |
|
56 | - * @param string $resourceType ('file', 'calendar',...) |
|
57 | - * @param string $sharedSecret |
|
58 | - */ |
|
59 | - public function __construct($shareWith = '', |
|
60 | - $name = '', |
|
61 | - $description = '', |
|
62 | - $providerId = '', |
|
63 | - $owner = '', |
|
64 | - $ownerDisplayName = '', |
|
65 | - $sharedBy = '', |
|
66 | - $sharedByDisplayName = '', |
|
67 | - $shareType = '', |
|
68 | - $resourceType = '', |
|
69 | - $sharedSecret = '' |
|
70 | - ) { |
|
71 | - $this->setShareWith($shareWith); |
|
72 | - $this->setResourceName($name); |
|
73 | - $this->setDescription($description); |
|
74 | - $this->setProviderId($providerId); |
|
75 | - $this->setOwner($owner); |
|
76 | - $this->setOwnerDisplayName($ownerDisplayName); |
|
77 | - $this->setSharedBy($sharedBy); |
|
78 | - $this->setSharedByDisplayName($sharedByDisplayName); |
|
79 | - $this->setProtocol([ |
|
80 | - 'name' => 'webdav', |
|
81 | - 'options' => [ |
|
82 | - 'sharedSecret' => $sharedSecret, |
|
83 | - 'permissions' => '{http://open-cloud-mesh.org/ns}share-permissions' |
|
84 | - ] |
|
85 | - ]); |
|
86 | - $this->setShareType($shareType); |
|
87 | - $this->setResourceType($resourceType); |
|
88 | - } |
|
44 | + /** |
|
45 | + * get a CloudFederationShare Object to prepare a share you want to send |
|
46 | + * |
|
47 | + * @param string $shareWith |
|
48 | + * @param string $name resource name (e.g. document.odt) |
|
49 | + * @param string $description share description (optional) |
|
50 | + * @param string $providerId resource UID on the provider side |
|
51 | + * @param string $owner provider specific UID of the user who owns the resource |
|
52 | + * @param string $ownerDisplayName display name of the user who shared the item |
|
53 | + * @param string $sharedBy provider specific UID of the user who shared the resource |
|
54 | + * @param string $sharedByDisplayName display name of the user who shared the resource |
|
55 | + * @param string $shareType ('group' or 'user' share) |
|
56 | + * @param string $resourceType ('file', 'calendar',...) |
|
57 | + * @param string $sharedSecret |
|
58 | + */ |
|
59 | + public function __construct($shareWith = '', |
|
60 | + $name = '', |
|
61 | + $description = '', |
|
62 | + $providerId = '', |
|
63 | + $owner = '', |
|
64 | + $ownerDisplayName = '', |
|
65 | + $sharedBy = '', |
|
66 | + $sharedByDisplayName = '', |
|
67 | + $shareType = '', |
|
68 | + $resourceType = '', |
|
69 | + $sharedSecret = '' |
|
70 | + ) { |
|
71 | + $this->setShareWith($shareWith); |
|
72 | + $this->setResourceName($name); |
|
73 | + $this->setDescription($description); |
|
74 | + $this->setProviderId($providerId); |
|
75 | + $this->setOwner($owner); |
|
76 | + $this->setOwnerDisplayName($ownerDisplayName); |
|
77 | + $this->setSharedBy($sharedBy); |
|
78 | + $this->setSharedByDisplayName($sharedByDisplayName); |
|
79 | + $this->setProtocol([ |
|
80 | + 'name' => 'webdav', |
|
81 | + 'options' => [ |
|
82 | + 'sharedSecret' => $sharedSecret, |
|
83 | + 'permissions' => '{http://open-cloud-mesh.org/ns}share-permissions' |
|
84 | + ] |
|
85 | + ]); |
|
86 | + $this->setShareType($shareType); |
|
87 | + $this->setResourceType($resourceType); |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * set uid of the recipient |
|
92 | - * |
|
93 | - * @param string $user |
|
94 | - * |
|
95 | - * @since 14.0.0 |
|
96 | - */ |
|
97 | - public function setShareWith($user) { |
|
98 | - $this->share['shareWith'] = $user; |
|
99 | - } |
|
90 | + /** |
|
91 | + * set uid of the recipient |
|
92 | + * |
|
93 | + * @param string $user |
|
94 | + * |
|
95 | + * @since 14.0.0 |
|
96 | + */ |
|
97 | + public function setShareWith($user) { |
|
98 | + $this->share['shareWith'] = $user; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * set resource name (e.g. document.odt) |
|
103 | - * |
|
104 | - * @param string $name |
|
105 | - * |
|
106 | - * @since 14.0.0 |
|
107 | - */ |
|
108 | - public function setResourceName($name) { |
|
109 | - $this->share['name'] = $name; |
|
110 | - } |
|
101 | + /** |
|
102 | + * set resource name (e.g. document.odt) |
|
103 | + * |
|
104 | + * @param string $name |
|
105 | + * |
|
106 | + * @since 14.0.0 |
|
107 | + */ |
|
108 | + public function setResourceName($name) { |
|
109 | + $this->share['name'] = $name; |
|
110 | + } |
|
111 | 111 | |
112 | - /** |
|
113 | - * set resource type (e.g. file, calendar, contact,...) |
|
114 | - * |
|
115 | - * @param string $resourceType |
|
116 | - * |
|
117 | - * @since 14.0.0 |
|
118 | - */ |
|
119 | - public function setResourceType($resourceType) { |
|
120 | - $this->share['resourceType'] = $resourceType; |
|
121 | - } |
|
112 | + /** |
|
113 | + * set resource type (e.g. file, calendar, contact,...) |
|
114 | + * |
|
115 | + * @param string $resourceType |
|
116 | + * |
|
117 | + * @since 14.0.0 |
|
118 | + */ |
|
119 | + public function setResourceType($resourceType) { |
|
120 | + $this->share['resourceType'] = $resourceType; |
|
121 | + } |
|
122 | 122 | |
123 | - /** |
|
124 | - * set resource description (optional) |
|
125 | - * |
|
126 | - * @param string $description |
|
127 | - * |
|
128 | - * @since 14.0.0 |
|
129 | - */ |
|
130 | - public function setDescription($description) { |
|
131 | - $this->share['description'] = $description; |
|
132 | - } |
|
123 | + /** |
|
124 | + * set resource description (optional) |
|
125 | + * |
|
126 | + * @param string $description |
|
127 | + * |
|
128 | + * @since 14.0.0 |
|
129 | + */ |
|
130 | + public function setDescription($description) { |
|
131 | + $this->share['description'] = $description; |
|
132 | + } |
|
133 | 133 | |
134 | - /** |
|
135 | - * set provider ID (e.g. file ID) |
|
136 | - * |
|
137 | - * @param string $providerId |
|
138 | - * |
|
139 | - * @since 14.0.0 |
|
140 | - */ |
|
141 | - public function setProviderId($providerId) { |
|
142 | - $this->share['providerId'] = $providerId; |
|
143 | - } |
|
134 | + /** |
|
135 | + * set provider ID (e.g. file ID) |
|
136 | + * |
|
137 | + * @param string $providerId |
|
138 | + * |
|
139 | + * @since 14.0.0 |
|
140 | + */ |
|
141 | + public function setProviderId($providerId) { |
|
142 | + $this->share['providerId'] = $providerId; |
|
143 | + } |
|
144 | 144 | |
145 | - /** |
|
146 | - * set owner UID |
|
147 | - * |
|
148 | - * @param string $owner |
|
149 | - * |
|
150 | - * @since 14.0.0 |
|
151 | - */ |
|
152 | - public function setOwner($owner) { |
|
153 | - $this->share['owner'] = $owner; |
|
154 | - } |
|
145 | + /** |
|
146 | + * set owner UID |
|
147 | + * |
|
148 | + * @param string $owner |
|
149 | + * |
|
150 | + * @since 14.0.0 |
|
151 | + */ |
|
152 | + public function setOwner($owner) { |
|
153 | + $this->share['owner'] = $owner; |
|
154 | + } |
|
155 | 155 | |
156 | - /** |
|
157 | - * set owner display name |
|
158 | - * |
|
159 | - * @param string $ownerDisplayName |
|
160 | - * |
|
161 | - * @since 14.0.0 |
|
162 | - */ |
|
163 | - public function setOwnerDisplayName($ownerDisplayName) { |
|
164 | - $this->share['ownerDisplayName'] = $ownerDisplayName; |
|
165 | - } |
|
156 | + /** |
|
157 | + * set owner display name |
|
158 | + * |
|
159 | + * @param string $ownerDisplayName |
|
160 | + * |
|
161 | + * @since 14.0.0 |
|
162 | + */ |
|
163 | + public function setOwnerDisplayName($ownerDisplayName) { |
|
164 | + $this->share['ownerDisplayName'] = $ownerDisplayName; |
|
165 | + } |
|
166 | 166 | |
167 | - /** |
|
168 | - * set UID of the user who sends the share |
|
169 | - * |
|
170 | - * @param string $sharedBy |
|
171 | - * |
|
172 | - * @since 14.0.0 |
|
173 | - */ |
|
174 | - public function setSharedBy($sharedBy) { |
|
175 | - $this->share['sharedBy'] = $sharedBy; |
|
176 | - } |
|
167 | + /** |
|
168 | + * set UID of the user who sends the share |
|
169 | + * |
|
170 | + * @param string $sharedBy |
|
171 | + * |
|
172 | + * @since 14.0.0 |
|
173 | + */ |
|
174 | + public function setSharedBy($sharedBy) { |
|
175 | + $this->share['sharedBy'] = $sharedBy; |
|
176 | + } |
|
177 | 177 | |
178 | - /** |
|
179 | - * set display name of the user who sends the share |
|
180 | - * |
|
181 | - * @param $sharedByDisplayName |
|
182 | - * |
|
183 | - * @since 14.0.0 |
|
184 | - */ |
|
185 | - public function setSharedByDisplayName($sharedByDisplayName) { |
|
186 | - $this->share['sharedByDisplayName'] = $sharedByDisplayName; |
|
187 | - } |
|
178 | + /** |
|
179 | + * set display name of the user who sends the share |
|
180 | + * |
|
181 | + * @param $sharedByDisplayName |
|
182 | + * |
|
183 | + * @since 14.0.0 |
|
184 | + */ |
|
185 | + public function setSharedByDisplayName($sharedByDisplayName) { |
|
186 | + $this->share['sharedByDisplayName'] = $sharedByDisplayName; |
|
187 | + } |
|
188 | 188 | |
189 | - /** |
|
190 | - * set protocol specification |
|
191 | - * |
|
192 | - * @param array $protocol |
|
193 | - * |
|
194 | - * @since 14.0.0 |
|
195 | - */ |
|
196 | - public function setProtocol(array $protocol) { |
|
197 | - $this->share['protocol'] = $protocol; |
|
198 | - } |
|
189 | + /** |
|
190 | + * set protocol specification |
|
191 | + * |
|
192 | + * @param array $protocol |
|
193 | + * |
|
194 | + * @since 14.0.0 |
|
195 | + */ |
|
196 | + public function setProtocol(array $protocol) { |
|
197 | + $this->share['protocol'] = $protocol; |
|
198 | + } |
|
199 | 199 | |
200 | - /** |
|
201 | - * share type (group or user) |
|
202 | - * |
|
203 | - * @param string $shareType |
|
204 | - * |
|
205 | - * @since 14.0.0 |
|
206 | - */ |
|
207 | - public function setShareType($shareType) { |
|
208 | - if ($shareType === 'group' || $shareType === IShare::TYPE_REMOTE_GROUP) { |
|
209 | - $this->share['shareType'] = 'group'; |
|
210 | - } else { |
|
211 | - $this->share['shareType'] = 'user'; |
|
212 | - } |
|
213 | - } |
|
200 | + /** |
|
201 | + * share type (group or user) |
|
202 | + * |
|
203 | + * @param string $shareType |
|
204 | + * |
|
205 | + * @since 14.0.0 |
|
206 | + */ |
|
207 | + public function setShareType($shareType) { |
|
208 | + if ($shareType === 'group' || $shareType === IShare::TYPE_REMOTE_GROUP) { |
|
209 | + $this->share['shareType'] = 'group'; |
|
210 | + } else { |
|
211 | + $this->share['shareType'] = 'user'; |
|
212 | + } |
|
213 | + } |
|
214 | 214 | |
215 | - /** |
|
216 | - * get the whole share, ready to send out |
|
217 | - * |
|
218 | - * @return array |
|
219 | - * |
|
220 | - * @since 14.0.0 |
|
221 | - */ |
|
222 | - public function getShare() { |
|
223 | - return $this->share; |
|
224 | - } |
|
215 | + /** |
|
216 | + * get the whole share, ready to send out |
|
217 | + * |
|
218 | + * @return array |
|
219 | + * |
|
220 | + * @since 14.0.0 |
|
221 | + */ |
|
222 | + public function getShare() { |
|
223 | + return $this->share; |
|
224 | + } |
|
225 | 225 | |
226 | - /** |
|
227 | - * get uid of the recipient |
|
228 | - * |
|
229 | - * @return string |
|
230 | - * |
|
231 | - * @since 14.0.0 |
|
232 | - */ |
|
233 | - public function getShareWith() { |
|
234 | - return $this->share['shareWith']; |
|
235 | - } |
|
226 | + /** |
|
227 | + * get uid of the recipient |
|
228 | + * |
|
229 | + * @return string |
|
230 | + * |
|
231 | + * @since 14.0.0 |
|
232 | + */ |
|
233 | + public function getShareWith() { |
|
234 | + return $this->share['shareWith']; |
|
235 | + } |
|
236 | 236 | |
237 | - /** |
|
238 | - * get resource name (e.g. file, calendar, contact,...) |
|
239 | - * |
|
240 | - * @return string |
|
241 | - * |
|
242 | - * @since 14.0.0 |
|
243 | - */ |
|
244 | - public function getResourceName() { |
|
245 | - return $this->share['name']; |
|
246 | - } |
|
237 | + /** |
|
238 | + * get resource name (e.g. file, calendar, contact,...) |
|
239 | + * |
|
240 | + * @return string |
|
241 | + * |
|
242 | + * @since 14.0.0 |
|
243 | + */ |
|
244 | + public function getResourceName() { |
|
245 | + return $this->share['name']; |
|
246 | + } |
|
247 | 247 | |
248 | - /** |
|
249 | - * get resource type (e.g. file, calendar, contact,...) |
|
250 | - * |
|
251 | - * @return string |
|
252 | - * |
|
253 | - * @since 14.0.0 |
|
254 | - */ |
|
255 | - public function getResourceType() { |
|
256 | - return $this->share['resourceType']; |
|
257 | - } |
|
248 | + /** |
|
249 | + * get resource type (e.g. file, calendar, contact,...) |
|
250 | + * |
|
251 | + * @return string |
|
252 | + * |
|
253 | + * @since 14.0.0 |
|
254 | + */ |
|
255 | + public function getResourceType() { |
|
256 | + return $this->share['resourceType']; |
|
257 | + } |
|
258 | 258 | |
259 | - /** |
|
260 | - * get resource description (optional) |
|
261 | - * |
|
262 | - * @return string |
|
263 | - * |
|
264 | - * @since 14.0.0 |
|
265 | - */ |
|
266 | - public function getDescription() { |
|
267 | - return $this->share['description']; |
|
268 | - } |
|
259 | + /** |
|
260 | + * get resource description (optional) |
|
261 | + * |
|
262 | + * @return string |
|
263 | + * |
|
264 | + * @since 14.0.0 |
|
265 | + */ |
|
266 | + public function getDescription() { |
|
267 | + return $this->share['description']; |
|
268 | + } |
|
269 | 269 | |
270 | - /** |
|
271 | - * get provider ID (e.g. file ID) |
|
272 | - * |
|
273 | - * @return string |
|
274 | - * |
|
275 | - * @since 14.0.0 |
|
276 | - */ |
|
277 | - public function getProviderId() { |
|
278 | - return $this->share['providerId']; |
|
279 | - } |
|
270 | + /** |
|
271 | + * get provider ID (e.g. file ID) |
|
272 | + * |
|
273 | + * @return string |
|
274 | + * |
|
275 | + * @since 14.0.0 |
|
276 | + */ |
|
277 | + public function getProviderId() { |
|
278 | + return $this->share['providerId']; |
|
279 | + } |
|
280 | 280 | |
281 | - /** |
|
282 | - * get owner UID |
|
283 | - * |
|
284 | - * @return string |
|
285 | - * |
|
286 | - * @since 14.0.0 |
|
287 | - */ |
|
288 | - public function getOwner() { |
|
289 | - return $this->share['owner']; |
|
290 | - } |
|
281 | + /** |
|
282 | + * get owner UID |
|
283 | + * |
|
284 | + * @return string |
|
285 | + * |
|
286 | + * @since 14.0.0 |
|
287 | + */ |
|
288 | + public function getOwner() { |
|
289 | + return $this->share['owner']; |
|
290 | + } |
|
291 | 291 | |
292 | - /** |
|
293 | - * get owner display name |
|
294 | - * |
|
295 | - * @return string |
|
296 | - * |
|
297 | - * @since 14.0.0 |
|
298 | - */ |
|
299 | - public function getOwnerDisplayName() { |
|
300 | - return $this->share['ownerDisplayName']; |
|
301 | - } |
|
292 | + /** |
|
293 | + * get owner display name |
|
294 | + * |
|
295 | + * @return string |
|
296 | + * |
|
297 | + * @since 14.0.0 |
|
298 | + */ |
|
299 | + public function getOwnerDisplayName() { |
|
300 | + return $this->share['ownerDisplayName']; |
|
301 | + } |
|
302 | 302 | |
303 | - /** |
|
304 | - * get UID of the user who sends the share |
|
305 | - * |
|
306 | - * @return string |
|
307 | - * |
|
308 | - * @since 14.0.0 |
|
309 | - */ |
|
310 | - public function getSharedBy() { |
|
311 | - return $this->share['sharedBy']; |
|
312 | - } |
|
303 | + /** |
|
304 | + * get UID of the user who sends the share |
|
305 | + * |
|
306 | + * @return string |
|
307 | + * |
|
308 | + * @since 14.0.0 |
|
309 | + */ |
|
310 | + public function getSharedBy() { |
|
311 | + return $this->share['sharedBy']; |
|
312 | + } |
|
313 | 313 | |
314 | - /** |
|
315 | - * get display name of the user who sends the share |
|
316 | - * |
|
317 | - * @return string |
|
318 | - * |
|
319 | - * @since 14.0.0 |
|
320 | - */ |
|
321 | - public function getSharedByDisplayName() { |
|
322 | - return $this->share['sharedByDisplayName']; |
|
323 | - } |
|
314 | + /** |
|
315 | + * get display name of the user who sends the share |
|
316 | + * |
|
317 | + * @return string |
|
318 | + * |
|
319 | + * @since 14.0.0 |
|
320 | + */ |
|
321 | + public function getSharedByDisplayName() { |
|
322 | + return $this->share['sharedByDisplayName']; |
|
323 | + } |
|
324 | 324 | |
325 | - /** |
|
326 | - * get share type (group or user) |
|
327 | - * |
|
328 | - * @return string |
|
329 | - * |
|
330 | - * @since 14.0.0 |
|
331 | - */ |
|
332 | - public function getShareType() { |
|
333 | - return $this->share['shareType']; |
|
334 | - } |
|
325 | + /** |
|
326 | + * get share type (group or user) |
|
327 | + * |
|
328 | + * @return string |
|
329 | + * |
|
330 | + * @since 14.0.0 |
|
331 | + */ |
|
332 | + public function getShareType() { |
|
333 | + return $this->share['shareType']; |
|
334 | + } |
|
335 | 335 | |
336 | - /** |
|
337 | - * get share Secret |
|
338 | - * |
|
339 | - * @return string |
|
340 | - * |
|
341 | - * @since 14.0.0 |
|
342 | - */ |
|
343 | - public function getShareSecret() { |
|
344 | - return $this->share['protocol']['options']['sharedSecret']; |
|
345 | - } |
|
336 | + /** |
|
337 | + * get share Secret |
|
338 | + * |
|
339 | + * @return string |
|
340 | + * |
|
341 | + * @since 14.0.0 |
|
342 | + */ |
|
343 | + public function getShareSecret() { |
|
344 | + return $this->share['protocol']['options']['sharedSecret']; |
|
345 | + } |
|
346 | 346 | |
347 | - /** |
|
348 | - * get protocol specification |
|
349 | - * |
|
350 | - * @return array |
|
351 | - * |
|
352 | - * @since 14.0.0 |
|
353 | - */ |
|
354 | - public function getProtocol() { |
|
355 | - return $this->share['protocol']; |
|
356 | - } |
|
347 | + /** |
|
348 | + * get protocol specification |
|
349 | + * |
|
350 | + * @return array |
|
351 | + * |
|
352 | + * @since 14.0.0 |
|
353 | + */ |
|
354 | + public function getProtocol() { |
|
355 | + return $this->share['protocol']; |
|
356 | + } |
|
357 | 357 | } |
@@ -36,60 +36,60 @@ |
||
36 | 36 | */ |
37 | 37 | class SetPasswordColumn implements IRepairStep { |
38 | 38 | |
39 | - /** @var IDBConnection */ |
|
40 | - private $connection; |
|
39 | + /** @var IDBConnection */ |
|
40 | + private $connection; |
|
41 | 41 | |
42 | - /** @var IConfig */ |
|
43 | - private $config; |
|
42 | + /** @var IConfig */ |
|
43 | + private $config; |
|
44 | 44 | |
45 | 45 | |
46 | - public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | - $this->connection = $connection; |
|
48 | - $this->config = $config; |
|
49 | - } |
|
46 | + public function __construct(IDBConnection $connection, IConfig $config) { |
|
47 | + $this->connection = $connection; |
|
48 | + $this->config = $config; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Returns the step's name |
|
53 | - * |
|
54 | - * @return string |
|
55 | - * @since 9.1.0 |
|
56 | - */ |
|
57 | - public function getName() { |
|
58 | - return 'Copy the share password into the dedicated column'; |
|
59 | - } |
|
51 | + /** |
|
52 | + * Returns the step's name |
|
53 | + * |
|
54 | + * @return string |
|
55 | + * @since 9.1.0 |
|
56 | + */ |
|
57 | + public function getName() { |
|
58 | + return 'Copy the share password into the dedicated column'; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * @param IOutput $output |
|
63 | - */ |
|
64 | - public function run(IOutput $output) { |
|
65 | - if (!$this->shouldRun()) { |
|
66 | - return; |
|
67 | - } |
|
61 | + /** |
|
62 | + * @param IOutput $output |
|
63 | + */ |
|
64 | + public function run(IOutput $output) { |
|
65 | + if (!$this->shouldRun()) { |
|
66 | + return; |
|
67 | + } |
|
68 | 68 | |
69 | - $query = $this->connection->getQueryBuilder(); |
|
70 | - $query |
|
71 | - ->update('share') |
|
72 | - ->set('password', 'share_with') |
|
73 | - ->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_LINK))) |
|
74 | - ->andWhere($query->expr()->isNotNull('share_with')); |
|
75 | - $result = $query->execute(); |
|
69 | + $query = $this->connection->getQueryBuilder(); |
|
70 | + $query |
|
71 | + ->update('share') |
|
72 | + ->set('password', 'share_with') |
|
73 | + ->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_LINK))) |
|
74 | + ->andWhere($query->expr()->isNotNull('share_with')); |
|
75 | + $result = $query->execute(); |
|
76 | 76 | |
77 | - if ($result === 0) { |
|
78 | - // No link updated, no need to run the second query |
|
79 | - return; |
|
80 | - } |
|
77 | + if ($result === 0) { |
|
78 | + // No link updated, no need to run the second query |
|
79 | + return; |
|
80 | + } |
|
81 | 81 | |
82 | - $clearQuery = $this->connection->getQueryBuilder(); |
|
83 | - $clearQuery |
|
84 | - ->update('share') |
|
85 | - ->set('share_with', $clearQuery->createNamedParameter(null)) |
|
86 | - ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(IShare::TYPE_LINK))); |
|
82 | + $clearQuery = $this->connection->getQueryBuilder(); |
|
83 | + $clearQuery |
|
84 | + ->update('share') |
|
85 | + ->set('share_with', $clearQuery->createNamedParameter(null)) |
|
86 | + ->where($clearQuery->expr()->eq('share_type', $clearQuery->createNamedParameter(IShare::TYPE_LINK))); |
|
87 | 87 | |
88 | - $clearQuery->execute(); |
|
89 | - } |
|
88 | + $clearQuery->execute(); |
|
89 | + } |
|
90 | 90 | |
91 | - protected function shouldRun() { |
|
92 | - $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
93 | - return version_compare($appVersion, '1.4.0', '<'); |
|
94 | - } |
|
91 | + protected function shouldRun() { |
|
92 | + $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
93 | + return version_compare($appVersion, '1.4.0', '<'); |
|
94 | + } |
|
95 | 95 | } |
@@ -37,46 +37,46 @@ |
||
37 | 37 | */ |
38 | 38 | class OwncloudGuestShareType implements IRepairStep { |
39 | 39 | |
40 | - /** @var IDBConnection */ |
|
41 | - private $connection; |
|
40 | + /** @var IDBConnection */ |
|
41 | + private $connection; |
|
42 | 42 | |
43 | - /** @var IConfig */ |
|
44 | - private $config; |
|
43 | + /** @var IConfig */ |
|
44 | + private $config; |
|
45 | 45 | |
46 | 46 | |
47 | - public function __construct(IDBConnection $connection, IConfig $config) { |
|
48 | - $this->connection = $connection; |
|
49 | - $this->config = $config; |
|
50 | - } |
|
47 | + public function __construct(IDBConnection $connection, IConfig $config) { |
|
48 | + $this->connection = $connection; |
|
49 | + $this->config = $config; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Returns the step's name |
|
54 | - * |
|
55 | - * @return string |
|
56 | - * @since 9.1.0 |
|
57 | - */ |
|
58 | - public function getName() { |
|
59 | - return 'Fix the share type of guest shares when migrating from ownCloud'; |
|
60 | - } |
|
52 | + /** |
|
53 | + * Returns the step's name |
|
54 | + * |
|
55 | + * @return string |
|
56 | + * @since 9.1.0 |
|
57 | + */ |
|
58 | + public function getName() { |
|
59 | + return 'Fix the share type of guest shares when migrating from ownCloud'; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @param IOutput $output |
|
64 | - */ |
|
65 | - public function run(IOutput $output) { |
|
66 | - if (!$this->shouldRun()) { |
|
67 | - return; |
|
68 | - } |
|
62 | + /** |
|
63 | + * @param IOutput $output |
|
64 | + */ |
|
65 | + public function run(IOutput $output) { |
|
66 | + if (!$this->shouldRun()) { |
|
67 | + return; |
|
68 | + } |
|
69 | 69 | |
70 | - $query = $this->connection->getQueryBuilder(); |
|
71 | - $query->update('share') |
|
72 | - ->set('share_type', $query->createNamedParameter(IShare::TYPE_GUEST)) |
|
73 | - ->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_EMAIL))); |
|
74 | - $query->execute(); |
|
75 | - } |
|
70 | + $query = $this->connection->getQueryBuilder(); |
|
71 | + $query->update('share') |
|
72 | + ->set('share_type', $query->createNamedParameter(IShare::TYPE_GUEST)) |
|
73 | + ->where($query->expr()->eq('share_type', $query->createNamedParameter(IShare::TYPE_EMAIL))); |
|
74 | + $query->execute(); |
|
75 | + } |
|
76 | 76 | |
77 | - protected function shouldRun() { |
|
78 | - $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
79 | - return $appVersion === '0.10.0' || |
|
80 | - $this->config->getAppValue('core', 'vendor', '') === 'owncloud'; |
|
81 | - } |
|
77 | + protected function shouldRun() { |
|
78 | + $appVersion = $this->config->getAppValue('files_sharing', 'installed_version', '0.0.0'); |
|
79 | + return $appVersion === '0.10.0' || |
|
80 | + $this->config->getAppValue('core', 'vendor', '') === 'owncloud'; |
|
81 | + } |
|
82 | 82 | } |
@@ -30,19 +30,19 @@ |
||
30 | 30 | use Symfony\Component\Console\Output\OutputInterface; |
31 | 31 | |
32 | 32 | class UpdateHtaccess extends Command { |
33 | - protected function configure() { |
|
34 | - $this |
|
35 | - ->setName('maintenance:update:htaccess') |
|
36 | - ->setDescription('Updates the .htaccess file'); |
|
37 | - } |
|
33 | + protected function configure() { |
|
34 | + $this |
|
35 | + ->setName('maintenance:update:htaccess') |
|
36 | + ->setDescription('Updates the .htaccess file'); |
|
37 | + } |
|
38 | 38 | |
39 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
40 | - if (\OC\Setup::updateHtaccess()) { |
|
41 | - $output->writeln('.htaccess has been updated'); |
|
42 | - return 0; |
|
43 | - } else { |
|
44 | - $output->writeln('<error>Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL?</error>'); |
|
45 | - return 1; |
|
46 | - } |
|
47 | - } |
|
39 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
40 | + if (\OC\Setup::updateHtaccess()) { |
|
41 | + $output->writeln('.htaccess has been updated'); |
|
42 | + return 0; |
|
43 | + } else { |
|
44 | + $output->writeln('<error>Error updating .htaccess file, not enough permissions or "overwrite.cli.url" set to an invalid URL?</error>'); |
|
45 | + return 1; |
|
46 | + } |
|
47 | + } |
|
48 | 48 | } |
@@ -33,52 +33,52 @@ |
||
33 | 33 | |
34 | 34 | class EnableMasterKey extends Command { |
35 | 35 | |
36 | - /** @var Util */ |
|
37 | - protected $util; |
|
36 | + /** @var Util */ |
|
37 | + protected $util; |
|
38 | 38 | |
39 | - /** @var IConfig */ |
|
40 | - protected $config; |
|
39 | + /** @var IConfig */ |
|
40 | + protected $config; |
|
41 | 41 | |
42 | - /** @var QuestionHelper */ |
|
43 | - protected $questionHelper; |
|
42 | + /** @var QuestionHelper */ |
|
43 | + protected $questionHelper; |
|
44 | 44 | |
45 | - /** |
|
46 | - * @param Util $util |
|
47 | - * @param IConfig $config |
|
48 | - * @param QuestionHelper $questionHelper |
|
49 | - */ |
|
50 | - public function __construct(Util $util, |
|
51 | - IConfig $config, |
|
52 | - QuestionHelper $questionHelper) { |
|
53 | - $this->util = $util; |
|
54 | - $this->config = $config; |
|
55 | - $this->questionHelper = $questionHelper; |
|
56 | - parent::__construct(); |
|
57 | - } |
|
45 | + /** |
|
46 | + * @param Util $util |
|
47 | + * @param IConfig $config |
|
48 | + * @param QuestionHelper $questionHelper |
|
49 | + */ |
|
50 | + public function __construct(Util $util, |
|
51 | + IConfig $config, |
|
52 | + QuestionHelper $questionHelper) { |
|
53 | + $this->util = $util; |
|
54 | + $this->config = $config; |
|
55 | + $this->questionHelper = $questionHelper; |
|
56 | + parent::__construct(); |
|
57 | + } |
|
58 | 58 | |
59 | - protected function configure() { |
|
60 | - $this |
|
61 | - ->setName('encryption:enable-master-key') |
|
62 | - ->setDescription('Enable the master key. Only available for fresh installations with no existing encrypted data! There is also no way to disable it again.'); |
|
63 | - } |
|
59 | + protected function configure() { |
|
60 | + $this |
|
61 | + ->setName('encryption:enable-master-key') |
|
62 | + ->setDescription('Enable the master key. Only available for fresh installations with no existing encrypted data! There is also no way to disable it again.'); |
|
63 | + } |
|
64 | 64 | |
65 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
66 | - $isAlreadyEnabled = $this->util->isMasterKeyEnabled(); |
|
65 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
66 | + $isAlreadyEnabled = $this->util->isMasterKeyEnabled(); |
|
67 | 67 | |
68 | - if ($isAlreadyEnabled) { |
|
69 | - $output->writeln('Master key already enabled'); |
|
70 | - } else { |
|
71 | - $question = new ConfirmationQuestion( |
|
72 | - 'Warning: Only available for fresh installations with no existing encrypted data! ' |
|
73 | - . 'There is also no way to disable it again. Do you want to continue? (y/n) ', false); |
|
74 | - if ($this->questionHelper->ask($input, $output, $question)) { |
|
75 | - $this->config->setAppValue('encryption', 'useMasterKey', '1'); |
|
76 | - $output->writeln('Master key successfully enabled.'); |
|
77 | - } else { |
|
78 | - $output->writeln('aborted.'); |
|
79 | - return 1; |
|
80 | - } |
|
81 | - } |
|
82 | - return 0; |
|
83 | - } |
|
68 | + if ($isAlreadyEnabled) { |
|
69 | + $output->writeln('Master key already enabled'); |
|
70 | + } else { |
|
71 | + $question = new ConfirmationQuestion( |
|
72 | + 'Warning: Only available for fresh installations with no existing encrypted data! ' |
|
73 | + . 'There is also no way to disable it again. Do you want to continue? (y/n) ', false); |
|
74 | + if ($this->questionHelper->ask($input, $output, $question)) { |
|
75 | + $this->config->setAppValue('encryption', 'useMasterKey', '1'); |
|
76 | + $output->writeln('Master key successfully enabled.'); |
|
77 | + } else { |
|
78 | + $output->writeln('aborted.'); |
|
79 | + return 1; |
|
80 | + } |
|
81 | + } |
|
82 | + return 0; |
|
83 | + } |
|
84 | 84 | } |
@@ -34,55 +34,55 @@ |
||
34 | 34 | |
35 | 35 | class DisableMasterKey extends Command { |
36 | 36 | |
37 | - /** @var Util */ |
|
38 | - protected $util; |
|
37 | + /** @var Util */ |
|
38 | + protected $util; |
|
39 | 39 | |
40 | - /** @var IConfig */ |
|
41 | - protected $config; |
|
40 | + /** @var IConfig */ |
|
41 | + protected $config; |
|
42 | 42 | |
43 | - /** @var QuestionHelper */ |
|
44 | - protected $questionHelper; |
|
43 | + /** @var QuestionHelper */ |
|
44 | + protected $questionHelper; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param Util $util |
|
48 | - * @param IConfig $config |
|
49 | - * @param QuestionHelper $questionHelper |
|
50 | - */ |
|
51 | - public function __construct(Util $util, |
|
52 | - IConfig $config, |
|
53 | - QuestionHelper $questionHelper) { |
|
54 | - $this->util = $util; |
|
55 | - $this->config = $config; |
|
56 | - $this->questionHelper = $questionHelper; |
|
57 | - parent::__construct(); |
|
58 | - } |
|
46 | + /** |
|
47 | + * @param Util $util |
|
48 | + * @param IConfig $config |
|
49 | + * @param QuestionHelper $questionHelper |
|
50 | + */ |
|
51 | + public function __construct(Util $util, |
|
52 | + IConfig $config, |
|
53 | + QuestionHelper $questionHelper) { |
|
54 | + $this->util = $util; |
|
55 | + $this->config = $config; |
|
56 | + $this->questionHelper = $questionHelper; |
|
57 | + parent::__construct(); |
|
58 | + } |
|
59 | 59 | |
60 | - protected function configure() { |
|
61 | - $this |
|
62 | - ->setName('encryption:disable-master-key') |
|
63 | - ->setDescription('Disable the master key and use per-user keys instead. Only available for fresh installations with no existing encrypted data! There is no way to enable it again.'); |
|
64 | - } |
|
60 | + protected function configure() { |
|
61 | + $this |
|
62 | + ->setName('encryption:disable-master-key') |
|
63 | + ->setDescription('Disable the master key and use per-user keys instead. Only available for fresh installations with no existing encrypted data! There is no way to enable it again.'); |
|
64 | + } |
|
65 | 65 | |
66 | - protected function execute(InputInterface $input, OutputInterface $output): int { |
|
67 | - $isMasterKeyEnabled = $this->util->isMasterKeyEnabled(); |
|
66 | + protected function execute(InputInterface $input, OutputInterface $output): int { |
|
67 | + $isMasterKeyEnabled = $this->util->isMasterKeyEnabled(); |
|
68 | 68 | |
69 | - if (!$isMasterKeyEnabled) { |
|
70 | - $output->writeln('Master key already disabled'); |
|
71 | - } else { |
|
72 | - $question = new ConfirmationQuestion( |
|
73 | - 'Warning: Only perform this operation for a fresh installations with no existing encrypted data! ' |
|
74 | - . 'There is no way to enable the master key again. ' |
|
75 | - . 'We strongly recommend to keep the master key, it provides significant performance improvements ' |
|
76 | - . 'and is easier to handle for both, users and administrators. ' |
|
77 | - . 'Do you really want to switch to per-user keys? (y/n) ', false); |
|
78 | - if ($this->questionHelper->ask($input, $output, $question)) { |
|
79 | - $this->config->setAppValue('encryption', 'useMasterKey', '0'); |
|
80 | - $output->writeln('Master key successfully disabled.'); |
|
81 | - } else { |
|
82 | - $output->writeln('aborted.'); |
|
83 | - return 1; |
|
84 | - } |
|
85 | - } |
|
86 | - return 0; |
|
87 | - } |
|
69 | + if (!$isMasterKeyEnabled) { |
|
70 | + $output->writeln('Master key already disabled'); |
|
71 | + } else { |
|
72 | + $question = new ConfirmationQuestion( |
|
73 | + 'Warning: Only perform this operation for a fresh installations with no existing encrypted data! ' |
|
74 | + . 'There is no way to enable the master key again. ' |
|
75 | + . 'We strongly recommend to keep the master key, it provides significant performance improvements ' |
|
76 | + . 'and is easier to handle for both, users and administrators. ' |
|
77 | + . 'Do you really want to switch to per-user keys? (y/n) ', false); |
|
78 | + if ($this->questionHelper->ask($input, $output, $question)) { |
|
79 | + $this->config->setAppValue('encryption', 'useMasterKey', '0'); |
|
80 | + $output->writeln('Master key successfully disabled.'); |
|
81 | + } else { |
|
82 | + $output->writeln('aborted.'); |
|
83 | + return 1; |
|
84 | + } |
|
85 | + } |
|
86 | + return 0; |
|
87 | + } |
|
88 | 88 | } |