@@ -35,64 +35,64 @@ |
||
| 35 | 35 | |
| 36 | 36 | class WipeController extends Controller { |
| 37 | 37 | |
| 38 | - /** @var RemoteWipe */ |
|
| 39 | - private $remoteWipe; |
|
| 38 | + /** @var RemoteWipe */ |
|
| 39 | + private $remoteWipe; |
|
| 40 | 40 | |
| 41 | - public function __construct(string $appName, |
|
| 42 | - IRequest $request, |
|
| 43 | - RemoteWipe $remoteWipe) { |
|
| 44 | - parent::__construct($appName, $request); |
|
| 41 | + public function __construct(string $appName, |
|
| 42 | + IRequest $request, |
|
| 43 | + RemoteWipe $remoteWipe) { |
|
| 44 | + parent::__construct($appName, $request); |
|
| 45 | 45 | |
| 46 | - $this->remoteWipe = $remoteWipe; |
|
| 47 | - } |
|
| 46 | + $this->remoteWipe = $remoteWipe; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @NoAdminRequired |
|
| 51 | - * @NoCSRFRequired |
|
| 52 | - * @PublicPage |
|
| 53 | - * |
|
| 54 | - * @AnonRateThrottle(limit=10, period=300) |
|
| 55 | - * |
|
| 56 | - * @param string $token |
|
| 57 | - * |
|
| 58 | - * @return JSONResponse |
|
| 59 | - */ |
|
| 60 | - public function checkWipe(string $token): JSONResponse { |
|
| 61 | - try { |
|
| 62 | - if ($this->remoteWipe->start($token)) { |
|
| 63 | - return new JSONResponse([ |
|
| 64 | - 'wipe' => true |
|
| 65 | - ]); |
|
| 66 | - } |
|
| 49 | + /** |
|
| 50 | + * @NoAdminRequired |
|
| 51 | + * @NoCSRFRequired |
|
| 52 | + * @PublicPage |
|
| 53 | + * |
|
| 54 | + * @AnonRateThrottle(limit=10, period=300) |
|
| 55 | + * |
|
| 56 | + * @param string $token |
|
| 57 | + * |
|
| 58 | + * @return JSONResponse |
|
| 59 | + */ |
|
| 60 | + public function checkWipe(string $token): JSONResponse { |
|
| 61 | + try { |
|
| 62 | + if ($this->remoteWipe->start($token)) { |
|
| 63 | + return new JSONResponse([ |
|
| 64 | + 'wipe' => true |
|
| 65 | + ]); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
| 69 | - } catch (InvalidTokenException $e) { |
|
| 70 | - return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
| 71 | - } |
|
| 72 | - } |
|
| 68 | + return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
| 69 | + } catch (InvalidTokenException $e) { |
|
| 70 | + return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * @NoAdminRequired |
|
| 77 | - * @NoCSRFRequired |
|
| 78 | - * @PublicPage |
|
| 79 | - * |
|
| 80 | - * @AnonRateThrottle(limit=10, period=300) |
|
| 81 | - * |
|
| 82 | - * @param string $token |
|
| 83 | - * |
|
| 84 | - * @return JSONResponse |
|
| 85 | - */ |
|
| 86 | - public function wipeDone(string $token): JSONResponse { |
|
| 87 | - try { |
|
| 88 | - if ($this->remoteWipe->finish($token)) { |
|
| 89 | - return new JSONResponse([]); |
|
| 90 | - } |
|
| 75 | + /** |
|
| 76 | + * @NoAdminRequired |
|
| 77 | + * @NoCSRFRequired |
|
| 78 | + * @PublicPage |
|
| 79 | + * |
|
| 80 | + * @AnonRateThrottle(limit=10, period=300) |
|
| 81 | + * |
|
| 82 | + * @param string $token |
|
| 83 | + * |
|
| 84 | + * @return JSONResponse |
|
| 85 | + */ |
|
| 86 | + public function wipeDone(string $token): JSONResponse { |
|
| 87 | + try { |
|
| 88 | + if ($this->remoteWipe->finish($token)) { |
|
| 89 | + return new JSONResponse([]); |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
| 93 | - } catch (InvalidTokenException $e) { |
|
| 94 | - return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
| 95 | - } |
|
| 96 | - } |
|
| 92 | + return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
| 93 | + } catch (InvalidTokenException $e) { |
|
| 94 | + return new JSONResponse([], Http::STATUS_NOT_FOUND); |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | 98 | } |
@@ -28,43 +28,43 @@ |
||
| 28 | 28 | |
| 29 | 29 | class LazyL10N implements IL10N { |
| 30 | 30 | |
| 31 | - /** @var IL10N */ |
|
| 32 | - private $l; |
|
| 31 | + /** @var IL10N */ |
|
| 32 | + private $l; |
|
| 33 | 33 | |
| 34 | - /** @var \Closure */ |
|
| 35 | - private $factory; |
|
| 34 | + /** @var \Closure */ |
|
| 35 | + private $factory; |
|
| 36 | 36 | |
| 37 | 37 | |
| 38 | - public function __construct(\Closure $factory) { |
|
| 39 | - $this->factory = $factory; |
|
| 40 | - } |
|
| 38 | + public function __construct(\Closure $factory) { |
|
| 39 | + $this->factory = $factory; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - private function getL(): IL10N { |
|
| 43 | - if ($this->l === null) { |
|
| 44 | - $this->l = ($this->factory)(); |
|
| 45 | - } |
|
| 42 | + private function getL(): IL10N { |
|
| 43 | + if ($this->l === null) { |
|
| 44 | + $this->l = ($this->factory)(); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return $this->l; |
|
| 48 | - } |
|
| 47 | + return $this->l; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - public function t(string $text, $parameters = []): string { |
|
| 51 | - return $this->getL()->t($text, $parameters); |
|
| 52 | - } |
|
| 50 | + public function t(string $text, $parameters = []): string { |
|
| 51 | + return $this->getL()->t($text, $parameters); |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - public function n(string $text_singular, string $text_plural, int $count, array $parameters = []): string { |
|
| 55 | - return $this->getL()->n($text_singular, $text_plural, $count, $parameters); |
|
| 56 | - } |
|
| 54 | + public function n(string $text_singular, string $text_plural, int $count, array $parameters = []): string { |
|
| 55 | + return $this->getL()->n($text_singular, $text_plural, $count, $parameters); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - public function l(string $type, $data, array $options = []) { |
|
| 59 | - return $this->getL()->l($type, $data, $options); |
|
| 60 | - } |
|
| 58 | + public function l(string $type, $data, array $options = []) { |
|
| 59 | + return $this->getL()->l($type, $data, $options); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - public function getLanguageCode(): string { |
|
| 63 | - return $this->getL()->getLanguageCode(); |
|
| 64 | - } |
|
| 62 | + public function getLanguageCode(): string { |
|
| 63 | + return $this->getL()->getLanguageCode(); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public function getLocaleCode(): string { |
|
| 67 | - return $this->getL()->getLocaleCode(); |
|
| 68 | - } |
|
| 66 | + public function getLocaleCode(): string { |
|
| 67 | + return $this->getL()->getLocaleCode(); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | 70 | } |
@@ -30,43 +30,43 @@ |
||
| 30 | 30 | |
| 31 | 31 | class RegenerateBirthdayCalendars implements IRepairStep { |
| 32 | 32 | |
| 33 | - /** @var IJobList */ |
|
| 34 | - private $jobList; |
|
| 33 | + /** @var IJobList */ |
|
| 34 | + private $jobList; |
|
| 35 | 35 | |
| 36 | - /** @var IConfig */ |
|
| 37 | - private $config; |
|
| 36 | + /** @var IConfig */ |
|
| 37 | + private $config; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * @param IJobList $jobList |
|
| 41 | - * @param IConfig $config |
|
| 42 | - */ |
|
| 43 | - public function __construct(IJobList $jobList, |
|
| 44 | - IConfig $config) { |
|
| 45 | - $this->jobList = $jobList; |
|
| 46 | - $this->config = $config; |
|
| 47 | - } |
|
| 39 | + /** |
|
| 40 | + * @param IJobList $jobList |
|
| 41 | + * @param IConfig $config |
|
| 42 | + */ |
|
| 43 | + public function __construct(IJobList $jobList, |
|
| 44 | + IConfig $config) { |
|
| 45 | + $this->jobList = $jobList; |
|
| 46 | + $this->config = $config; |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * @return string |
|
| 51 | - */ |
|
| 52 | - public function getName() { |
|
| 53 | - return 'Regenerating birthday calendars to use new icons and fix old birthday events without year'; |
|
| 54 | - } |
|
| 49 | + /** |
|
| 50 | + * @return string |
|
| 51 | + */ |
|
| 52 | + public function getName() { |
|
| 53 | + return 'Regenerating birthday calendars to use new icons and fix old birthday events without year'; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - /** |
|
| 57 | - * @param IOutput $output |
|
| 58 | - */ |
|
| 59 | - public function run(IOutput $output) { |
|
| 60 | - // only run once |
|
| 61 | - if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes') { |
|
| 62 | - $output->info('Repair step already executed'); |
|
| 63 | - return; |
|
| 64 | - } |
|
| 56 | + /** |
|
| 57 | + * @param IOutput $output |
|
| 58 | + */ |
|
| 59 | + public function run(IOutput $output) { |
|
| 60 | + // only run once |
|
| 61 | + if ($this->config->getAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix') === 'yes') { |
|
| 62 | + $output->info('Repair step already executed'); |
|
| 63 | + return; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - $output->info('Adding background jobs to regenerate birthday calendar'); |
|
| 67 | - $this->jobList->add(RegisterRegenerateBirthdayCalendars::class); |
|
| 66 | + $output->info('Adding background jobs to regenerate birthday calendar'); |
|
| 67 | + $this->jobList->add(RegisterRegenerateBirthdayCalendars::class); |
|
| 68 | 68 | |
| 69 | - // if all were done, no need to redo the repair during next upgrade |
|
| 70 | - $this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes'); |
|
| 71 | - } |
|
| 69 | + // if all were done, no need to redo the repair during next upgrade |
|
| 70 | + $this->config->setAppValue('dav', 'regeneratedBirthdayCalendarsForYearFix', 'yes'); |
|
| 71 | + } |
|
| 72 | 72 | } |
@@ -60,7 +60,7 @@ |
||
| 60 | 60 | */ |
| 61 | 61 | public function getForm() { |
| 62 | 62 | $cloudID = $this->userSession->getUser()->getCloudId(); |
| 63 | - $url = 'https://nextcloud.com/sharing#' . $cloudID; |
|
| 63 | + $url = 'https://nextcloud.com/sharing#'.$cloudID; |
|
| 64 | 64 | |
| 65 | 65 | $parameters = [ |
| 66 | 66 | 'message_with_URL' => $this->l->t('Share with me through my #Nextcloud Federated Cloud ID, see %s', [$url]), |
@@ -35,78 +35,78 @@ |
||
| 35 | 35 | use OCP\Settings\ISettings; |
| 36 | 36 | |
| 37 | 37 | class Personal implements ISettings { |
| 38 | - private FederatedShareProvider $federatedShareProvider; |
|
| 39 | - private IUserSession $userSession; |
|
| 40 | - private IL10N $l; |
|
| 41 | - private \OC_Defaults $defaults; |
|
| 42 | - private IInitialState $initialState; |
|
| 43 | - private IURLGenerator $urlGenerator; |
|
| 38 | + private FederatedShareProvider $federatedShareProvider; |
|
| 39 | + private IUserSession $userSession; |
|
| 40 | + private IL10N $l; |
|
| 41 | + private \OC_Defaults $defaults; |
|
| 42 | + private IInitialState $initialState; |
|
| 43 | + private IURLGenerator $urlGenerator; |
|
| 44 | 44 | |
| 45 | - public function __construct( |
|
| 46 | - FederatedShareProvider $federatedShareProvider, # |
|
| 47 | - IUserSession $userSession, |
|
| 48 | - IL10N $l, |
|
| 49 | - \OC_Defaults $defaults, |
|
| 50 | - IInitialState $initialState, |
|
| 51 | - IURLGenerator $urlGenerator |
|
| 52 | - ) { |
|
| 53 | - $this->federatedShareProvider = $federatedShareProvider; |
|
| 54 | - $this->userSession = $userSession; |
|
| 55 | - $this->l = $l; |
|
| 56 | - $this->defaults = $defaults; |
|
| 57 | - $this->initialState = $initialState; |
|
| 58 | - $this->urlGenerator = $urlGenerator; |
|
| 59 | - } |
|
| 45 | + public function __construct( |
|
| 46 | + FederatedShareProvider $federatedShareProvider, # |
|
| 47 | + IUserSession $userSession, |
|
| 48 | + IL10N $l, |
|
| 49 | + \OC_Defaults $defaults, |
|
| 50 | + IInitialState $initialState, |
|
| 51 | + IURLGenerator $urlGenerator |
|
| 52 | + ) { |
|
| 53 | + $this->federatedShareProvider = $federatedShareProvider; |
|
| 54 | + $this->userSession = $userSession; |
|
| 55 | + $this->l = $l; |
|
| 56 | + $this->defaults = $defaults; |
|
| 57 | + $this->initialState = $initialState; |
|
| 58 | + $this->urlGenerator = $urlGenerator; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - /** |
|
| 62 | - * @return TemplateResponse returns the instance with all parameters set, ready to be rendered |
|
| 63 | - * @since 9.1 |
|
| 64 | - */ |
|
| 65 | - public function getForm() { |
|
| 66 | - $cloudID = $this->userSession->getUser()->getCloudId(); |
|
| 67 | - $url = 'https://nextcloud.com/sharing#' . $cloudID; |
|
| 61 | + /** |
|
| 62 | + * @return TemplateResponse returns the instance with all parameters set, ready to be rendered |
|
| 63 | + * @since 9.1 |
|
| 64 | + */ |
|
| 65 | + public function getForm() { |
|
| 66 | + $cloudID = $this->userSession->getUser()->getCloudId(); |
|
| 67 | + $url = 'https://nextcloud.com/sharing#' . $cloudID; |
|
| 68 | 68 | |
| 69 | - $parameters = [ |
|
| 70 | - 'message_with_URL' => $this->l->t('Share with me through my #Nextcloud Federated Cloud ID, see %s', [$url]), |
|
| 71 | - 'message_without_URL' => $this->l->t('Share with me through my #Nextcloud Federated Cloud ID', [$cloudID]), |
|
| 72 | - 'logoPath' => $this->defaults->getLogo(), |
|
| 73 | - 'reference' => $url, |
|
| 74 | - 'cloudId' => $cloudID, |
|
| 75 | - 'color' => $this->defaults->getColorPrimary(), |
|
| 76 | - 'textColor' => "#ffffff", |
|
| 77 | - ]; |
|
| 69 | + $parameters = [ |
|
| 70 | + 'message_with_URL' => $this->l->t('Share with me through my #Nextcloud Federated Cloud ID, see %s', [$url]), |
|
| 71 | + 'message_without_URL' => $this->l->t('Share with me through my #Nextcloud Federated Cloud ID', [$cloudID]), |
|
| 72 | + 'logoPath' => $this->defaults->getLogo(), |
|
| 73 | + 'reference' => $url, |
|
| 74 | + 'cloudId' => $cloudID, |
|
| 75 | + 'color' => $this->defaults->getColorPrimary(), |
|
| 76 | + 'textColor' => "#ffffff", |
|
| 77 | + ]; |
|
| 78 | 78 | |
| 79 | - $this->initialState->provideInitialState('color', $this->defaults->getColorPrimary()); |
|
| 80 | - $this->initialState->provideInitialState('textColor', '#fffff'); |
|
| 81 | - $this->initialState->provideInitialState('logoPath', $this->defaults->getLogo()); |
|
| 82 | - $this->initialState->provideInitialState('reference', $url); |
|
| 83 | - $this->initialState->provideInitialState('cloudId', $cloudID); |
|
| 84 | - $this->initialState->provideInitialState('docUrlFederated', $this->urlGenerator->linkToDocs('user-sharing-federated')); |
|
| 79 | + $this->initialState->provideInitialState('color', $this->defaults->getColorPrimary()); |
|
| 80 | + $this->initialState->provideInitialState('textColor', '#fffff'); |
|
| 81 | + $this->initialState->provideInitialState('logoPath', $this->defaults->getLogo()); |
|
| 82 | + $this->initialState->provideInitialState('reference', $url); |
|
| 83 | + $this->initialState->provideInitialState('cloudId', $cloudID); |
|
| 84 | + $this->initialState->provideInitialState('docUrlFederated', $this->urlGenerator->linkToDocs('user-sharing-federated')); |
|
| 85 | 85 | |
| 86 | - return new TemplateResponse('federatedfilesharing', 'settings-personal', $parameters, ''); |
|
| 87 | - } |
|
| 86 | + return new TemplateResponse('federatedfilesharing', 'settings-personal', $parameters, ''); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - /** |
|
| 90 | - * @return string the section ID, e.g. 'sharing' |
|
| 91 | - * @since 9.1 |
|
| 92 | - */ |
|
| 93 | - public function getSection() { |
|
| 94 | - if ($this->federatedShareProvider->isIncomingServer2serverShareEnabled() || |
|
| 95 | - $this->federatedShareProvider->isIncomingServer2serverGroupShareEnabled()) { |
|
| 96 | - return 'sharing'; |
|
| 97 | - } |
|
| 98 | - return null; |
|
| 99 | - } |
|
| 89 | + /** |
|
| 90 | + * @return string the section ID, e.g. 'sharing' |
|
| 91 | + * @since 9.1 |
|
| 92 | + */ |
|
| 93 | + public function getSection() { |
|
| 94 | + if ($this->federatedShareProvider->isIncomingServer2serverShareEnabled() || |
|
| 95 | + $this->federatedShareProvider->isIncomingServer2serverGroupShareEnabled()) { |
|
| 96 | + return 'sharing'; |
|
| 97 | + } |
|
| 98 | + return null; |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - /** |
|
| 102 | - * @return int whether the form should be rather on the top or bottom of |
|
| 103 | - * the admin section. The forms are arranged in ascending order of the |
|
| 104 | - * priority values. It is required to return a value between 0 and 100. |
|
| 105 | - * |
|
| 106 | - * E.g.: 70 |
|
| 107 | - * @since 9.1 |
|
| 108 | - */ |
|
| 109 | - public function getPriority() { |
|
| 110 | - return 40; |
|
| 111 | - } |
|
| 101 | + /** |
|
| 102 | + * @return int whether the form should be rather on the top or bottom of |
|
| 103 | + * the admin section. The forms are arranged in ascending order of the |
|
| 104 | + * priority values. It is required to return a value between 0 and 100. |
|
| 105 | + * |
|
| 106 | + * E.g.: 70 |
|
| 107 | + * @since 9.1 |
|
| 108 | + */ |
|
| 109 | + public function getPriority() { |
|
| 110 | + return 40; |
|
| 111 | + } |
|
| 112 | 112 | } |
@@ -26,88 +26,88 @@ |
||
| 26 | 26 | use OCP\IUser; |
| 27 | 27 | |
| 28 | 28 | class Version implements IVersion { |
| 29 | - /** @var int */ |
|
| 30 | - private $timestamp; |
|
| 31 | - |
|
| 32 | - /** @var int|string */ |
|
| 33 | - private $revisionId; |
|
| 34 | - |
|
| 35 | - /** @var string */ |
|
| 36 | - private $name; |
|
| 37 | - |
|
| 38 | - /** @var int */ |
|
| 39 | - private $size; |
|
| 40 | - |
|
| 41 | - /** @var string */ |
|
| 42 | - private $mimetype; |
|
| 43 | - |
|
| 44 | - /** @var string */ |
|
| 45 | - private $path; |
|
| 46 | - |
|
| 47 | - /** @var FileInfo */ |
|
| 48 | - private $sourceFileInfo; |
|
| 49 | - |
|
| 50 | - /** @var IVersionBackend */ |
|
| 51 | - private $backend; |
|
| 52 | - |
|
| 53 | - /** @var IUser */ |
|
| 54 | - private $user; |
|
| 55 | - |
|
| 56 | - public function __construct( |
|
| 57 | - int $timestamp, |
|
| 58 | - $revisionId, |
|
| 59 | - string $name, |
|
| 60 | - int $size, |
|
| 61 | - string $mimetype, |
|
| 62 | - string $path, |
|
| 63 | - FileInfo $sourceFileInfo, |
|
| 64 | - IVersionBackend $backend, |
|
| 65 | - IUser $user |
|
| 66 | - ) { |
|
| 67 | - $this->timestamp = $timestamp; |
|
| 68 | - $this->revisionId = $revisionId; |
|
| 69 | - $this->name = $name; |
|
| 70 | - $this->size = $size; |
|
| 71 | - $this->mimetype = $mimetype; |
|
| 72 | - $this->path = $path; |
|
| 73 | - $this->sourceFileInfo = $sourceFileInfo; |
|
| 74 | - $this->backend = $backend; |
|
| 75 | - $this->user = $user; |
|
| 76 | - } |
|
| 77 | - |
|
| 78 | - public function getBackend(): IVersionBackend { |
|
| 79 | - return $this->backend; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - public function getSourceFile(): FileInfo { |
|
| 83 | - return $this->sourceFileInfo; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - public function getRevisionId() { |
|
| 87 | - return $this->revisionId; |
|
| 88 | - } |
|
| 89 | - |
|
| 90 | - public function getTimestamp(): int { |
|
| 91 | - return $this->timestamp; |
|
| 92 | - } |
|
| 93 | - |
|
| 94 | - public function getSize(): int { |
|
| 95 | - return $this->size; |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - public function getSourceFileName(): string { |
|
| 99 | - return $this->name; |
|
| 100 | - } |
|
| 101 | - |
|
| 102 | - public function getMimeType(): string { |
|
| 103 | - return $this->mimetype; |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - public function getVersionPath(): string { |
|
| 107 | - return $this->path; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - public function getUser(): IUser { |
|
| 111 | - return $this->user; |
|
| 112 | - } |
|
| 29 | + /** @var int */ |
|
| 30 | + private $timestamp; |
|
| 31 | + |
|
| 32 | + /** @var int|string */ |
|
| 33 | + private $revisionId; |
|
| 34 | + |
|
| 35 | + /** @var string */ |
|
| 36 | + private $name; |
|
| 37 | + |
|
| 38 | + /** @var int */ |
|
| 39 | + private $size; |
|
| 40 | + |
|
| 41 | + /** @var string */ |
|
| 42 | + private $mimetype; |
|
| 43 | + |
|
| 44 | + /** @var string */ |
|
| 45 | + private $path; |
|
| 46 | + |
|
| 47 | + /** @var FileInfo */ |
|
| 48 | + private $sourceFileInfo; |
|
| 49 | + |
|
| 50 | + /** @var IVersionBackend */ |
|
| 51 | + private $backend; |
|
| 52 | + |
|
| 53 | + /** @var IUser */ |
|
| 54 | + private $user; |
|
| 55 | + |
|
| 56 | + public function __construct( |
|
| 57 | + int $timestamp, |
|
| 58 | + $revisionId, |
|
| 59 | + string $name, |
|
| 60 | + int $size, |
|
| 61 | + string $mimetype, |
|
| 62 | + string $path, |
|
| 63 | + FileInfo $sourceFileInfo, |
|
| 64 | + IVersionBackend $backend, |
|
| 65 | + IUser $user |
|
| 66 | + ) { |
|
| 67 | + $this->timestamp = $timestamp; |
|
| 68 | + $this->revisionId = $revisionId; |
|
| 69 | + $this->name = $name; |
|
| 70 | + $this->size = $size; |
|
| 71 | + $this->mimetype = $mimetype; |
|
| 72 | + $this->path = $path; |
|
| 73 | + $this->sourceFileInfo = $sourceFileInfo; |
|
| 74 | + $this->backend = $backend; |
|
| 75 | + $this->user = $user; |
|
| 76 | + } |
|
| 77 | + |
|
| 78 | + public function getBackend(): IVersionBackend { |
|
| 79 | + return $this->backend; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + public function getSourceFile(): FileInfo { |
|
| 83 | + return $this->sourceFileInfo; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + public function getRevisionId() { |
|
| 87 | + return $this->revisionId; |
|
| 88 | + } |
|
| 89 | + |
|
| 90 | + public function getTimestamp(): int { |
|
| 91 | + return $this->timestamp; |
|
| 92 | + } |
|
| 93 | + |
|
| 94 | + public function getSize(): int { |
|
| 95 | + return $this->size; |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + public function getSourceFileName(): string { |
|
| 99 | + return $this->name; |
|
| 100 | + } |
|
| 101 | + |
|
| 102 | + public function getMimeType(): string { |
|
| 103 | + return $this->mimetype; |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + public function getVersionPath(): string { |
|
| 107 | + return $this->path; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + public function getUser(): IUser { |
|
| 111 | + return $this->user; |
|
| 112 | + } |
|
| 113 | 113 | } |
@@ -29,71 +29,71 @@ |
||
| 29 | 29 | * @since 15.0.0 |
| 30 | 30 | */ |
| 31 | 31 | interface IVersion { |
| 32 | - /** |
|
| 33 | - * @return IVersionBackend |
|
| 34 | - * @since 15.0.0 |
|
| 35 | - */ |
|
| 36 | - public function getBackend(): IVersionBackend; |
|
| 32 | + /** |
|
| 33 | + * @return IVersionBackend |
|
| 34 | + * @since 15.0.0 |
|
| 35 | + */ |
|
| 36 | + public function getBackend(): IVersionBackend; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Get the file info of the source file |
|
| 40 | - * |
|
| 41 | - * @return FileInfo |
|
| 42 | - * @since 15.0.0 |
|
| 43 | - */ |
|
| 44 | - public function getSourceFile(): FileInfo; |
|
| 38 | + /** |
|
| 39 | + * Get the file info of the source file |
|
| 40 | + * |
|
| 41 | + * @return FileInfo |
|
| 42 | + * @since 15.0.0 |
|
| 43 | + */ |
|
| 44 | + public function getSourceFile(): FileInfo; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Get the id of the revision for the file |
|
| 48 | - * |
|
| 49 | - * @return int|string |
|
| 50 | - * @since 15.0.0 |
|
| 51 | - */ |
|
| 52 | - public function getRevisionId(); |
|
| 46 | + /** |
|
| 47 | + * Get the id of the revision for the file |
|
| 48 | + * |
|
| 49 | + * @return int|string |
|
| 50 | + * @since 15.0.0 |
|
| 51 | + */ |
|
| 52 | + public function getRevisionId(); |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Get the timestamp this version was created |
|
| 56 | - * |
|
| 57 | - * @return int |
|
| 58 | - * @since 15.0.0 |
|
| 59 | - */ |
|
| 60 | - public function getTimestamp(): int; |
|
| 54 | + /** |
|
| 55 | + * Get the timestamp this version was created |
|
| 56 | + * |
|
| 57 | + * @return int |
|
| 58 | + * @since 15.0.0 |
|
| 59 | + */ |
|
| 60 | + public function getTimestamp(): int; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Get the size of this version |
|
| 64 | - * |
|
| 65 | - * @return int |
|
| 66 | - * @since 15.0.0 |
|
| 67 | - */ |
|
| 68 | - public function getSize(): int; |
|
| 62 | + /** |
|
| 63 | + * Get the size of this version |
|
| 64 | + * |
|
| 65 | + * @return int |
|
| 66 | + * @since 15.0.0 |
|
| 67 | + */ |
|
| 68 | + public function getSize(): int; |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Get the name of the source file at the time of making this version |
|
| 72 | - * |
|
| 73 | - * @return string |
|
| 74 | - * @since 15.0.0 |
|
| 75 | - */ |
|
| 76 | - public function getSourceFileName(): string; |
|
| 70 | + /** |
|
| 71 | + * Get the name of the source file at the time of making this version |
|
| 72 | + * |
|
| 73 | + * @return string |
|
| 74 | + * @since 15.0.0 |
|
| 75 | + */ |
|
| 76 | + public function getSourceFileName(): string; |
|
| 77 | 77 | |
| 78 | - /** |
|
| 79 | - * Get the mimetype of this version |
|
| 80 | - * |
|
| 81 | - * @return string |
|
| 82 | - * @since 15.0.0 |
|
| 83 | - */ |
|
| 84 | - public function getMimeType(): string; |
|
| 78 | + /** |
|
| 79 | + * Get the mimetype of this version |
|
| 80 | + * |
|
| 81 | + * @return string |
|
| 82 | + * @since 15.0.0 |
|
| 83 | + */ |
|
| 84 | + public function getMimeType(): string; |
|
| 85 | 85 | |
| 86 | - /** |
|
| 87 | - * Get the path of this version |
|
| 88 | - * |
|
| 89 | - * @return string |
|
| 90 | - * @since 15.0.0 |
|
| 91 | - */ |
|
| 92 | - public function getVersionPath(): string; |
|
| 86 | + /** |
|
| 87 | + * Get the path of this version |
|
| 88 | + * |
|
| 89 | + * @return string |
|
| 90 | + * @since 15.0.0 |
|
| 91 | + */ |
|
| 92 | + public function getVersionPath(): string; |
|
| 93 | 93 | |
| 94 | - /** |
|
| 95 | - * @return IUser |
|
| 96 | - * @since 15.0.0 |
|
| 97 | - */ |
|
| 98 | - public function getUser(): IUser; |
|
| 94 | + /** |
|
| 95 | + * @return IUser |
|
| 96 | + * @since 15.0.0 |
|
| 97 | + */ |
|
| 98 | + public function getUser(): IUser; |
|
| 99 | 99 | } |
@@ -26,68 +26,68 @@ |
||
| 26 | 26 | |
| 27 | 27 | interface ILDAPUserPlugin { |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Check if plugin implements actions |
|
| 31 | - * @return int |
|
| 32 | - * |
|
| 33 | - * Returns the supported actions as int to be |
|
| 34 | - * compared with OC_USER_BACKEND_CREATE_USER etc. |
|
| 35 | - */ |
|
| 36 | - public function respondToActions(); |
|
| 29 | + /** |
|
| 30 | + * Check if plugin implements actions |
|
| 31 | + * @return int |
|
| 32 | + * |
|
| 33 | + * Returns the supported actions as int to be |
|
| 34 | + * compared with OC_USER_BACKEND_CREATE_USER etc. |
|
| 35 | + */ |
|
| 36 | + public function respondToActions(); |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Create a new user in LDAP Backend |
|
| 40 | - * |
|
| 41 | - * @param string $uid The UID of the user to create |
|
| 42 | - * @param string $password The password of the new user |
|
| 43 | - * @return bool|string |
|
| 44 | - */ |
|
| 45 | - public function createUser($uid, $password); |
|
| 38 | + /** |
|
| 39 | + * Create a new user in LDAP Backend |
|
| 40 | + * |
|
| 41 | + * @param string $uid The UID of the user to create |
|
| 42 | + * @param string $password The password of the new user |
|
| 43 | + * @return bool|string |
|
| 44 | + */ |
|
| 45 | + public function createUser($uid, $password); |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Set password |
|
| 49 | - * |
|
| 50 | - * @param string $uid The username |
|
| 51 | - * @param string $password The new password |
|
| 52 | - * @return bool |
|
| 53 | - * |
|
| 54 | - * Change the password of a user |
|
| 55 | - */ |
|
| 56 | - public function setPassword($uid, $password); |
|
| 47 | + /** |
|
| 48 | + * Set password |
|
| 49 | + * |
|
| 50 | + * @param string $uid The username |
|
| 51 | + * @param string $password The new password |
|
| 52 | + * @return bool |
|
| 53 | + * |
|
| 54 | + * Change the password of a user |
|
| 55 | + */ |
|
| 56 | + public function setPassword($uid, $password); |
|
| 57 | 57 | |
| 58 | - /** |
|
| 59 | - * get the user's home directory |
|
| 60 | - * @param string $uid the username |
|
| 61 | - * @return boolean |
|
| 62 | - */ |
|
| 63 | - public function getHome($uid); |
|
| 58 | + /** |
|
| 59 | + * get the user's home directory |
|
| 60 | + * @param string $uid the username |
|
| 61 | + * @return boolean |
|
| 62 | + */ |
|
| 63 | + public function getHome($uid); |
|
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * get display name of the user |
|
| 67 | - * @param string $uid user ID of the user |
|
| 68 | - * @return string display name |
|
| 69 | - */ |
|
| 70 | - public function getDisplayName($uid); |
|
| 65 | + /** |
|
| 66 | + * get display name of the user |
|
| 67 | + * @param string $uid user ID of the user |
|
| 68 | + * @return string display name |
|
| 69 | + */ |
|
| 70 | + public function getDisplayName($uid); |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * set display name of the user |
|
| 74 | - * @param string $uid user ID of the user |
|
| 75 | - * @param string $displayName new user's display name |
|
| 76 | - * @return string display name |
|
| 77 | - */ |
|
| 78 | - public function setDisplayName($uid, $displayName); |
|
| 72 | + /** |
|
| 73 | + * set display name of the user |
|
| 74 | + * @param string $uid user ID of the user |
|
| 75 | + * @param string $displayName new user's display name |
|
| 76 | + * @return string display name |
|
| 77 | + */ |
|
| 78 | + public function setDisplayName($uid, $displayName); |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * checks whether the user is allowed to change his avatar in Nextcloud |
|
| 82 | - * @param string $uid the Nextcloud user name |
|
| 83 | - * @return boolean either the user can or cannot |
|
| 84 | - */ |
|
| 85 | - public function canChangeAvatar($uid); |
|
| 80 | + /** |
|
| 81 | + * checks whether the user is allowed to change his avatar in Nextcloud |
|
| 82 | + * @param string $uid the Nextcloud user name |
|
| 83 | + * @return boolean either the user can or cannot |
|
| 84 | + */ |
|
| 85 | + public function canChangeAvatar($uid); |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * Count the number of users |
|
| 89 | - * @return int|bool |
|
| 90 | - */ |
|
| 91 | - public function countUsers(); |
|
| 87 | + /** |
|
| 88 | + * Count the number of users |
|
| 89 | + * @return int|bool |
|
| 90 | + */ |
|
| 91 | + public function countUsers(); |
|
| 92 | 92 | |
| 93 | 93 | } |
@@ -33,30 +33,30 @@ |
||
| 33 | 33 | |
| 34 | 34 | class ProviderEnabled implements IEventListener { |
| 35 | 35 | |
| 36 | - /** @var IRegistry */ |
|
| 37 | - private $registry; |
|
| 38 | - |
|
| 39 | - /** @var IJobList */ |
|
| 40 | - private $jobList; |
|
| 41 | - |
|
| 42 | - public function __construct(IRegistry $registry, |
|
| 43 | - IJobList $jobList) { |
|
| 44 | - $this->registry = $registry; |
|
| 45 | - $this->jobList = $jobList; |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - public function handle(Event $event): void { |
|
| 49 | - if (!($event instanceof RegistryEvent)) { |
|
| 50 | - return; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - $providers = $this->registry->getProviderStates($event->getUser()); |
|
| 54 | - if (isset($providers['backup_codes']) && $providers['backup_codes'] === true) { |
|
| 55 | - // Backup codes already generated nothing to do here |
|
| 56 | - return; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - $this->jobList->add(RememberBackupCodesJob::class, ['uid' => $event->getUser()->getUID()]); |
|
| 60 | - } |
|
| 36 | + /** @var IRegistry */ |
|
| 37 | + private $registry; |
|
| 38 | + |
|
| 39 | + /** @var IJobList */ |
|
| 40 | + private $jobList; |
|
| 41 | + |
|
| 42 | + public function __construct(IRegistry $registry, |
|
| 43 | + IJobList $jobList) { |
|
| 44 | + $this->registry = $registry; |
|
| 45 | + $this->jobList = $jobList; |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + public function handle(Event $event): void { |
|
| 49 | + if (!($event instanceof RegistryEvent)) { |
|
| 50 | + return; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + $providers = $this->registry->getProviderStates($event->getUser()); |
|
| 54 | + if (isset($providers['backup_codes']) && $providers['backup_codes'] === true) { |
|
| 55 | + // Backup codes already generated nothing to do here |
|
| 56 | + return; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + $this->jobList->add(RememberBackupCodesJob::class, ['uid' => $event->getUser()->getUID()]); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | 62 | } |
@@ -33,22 +33,22 @@ |
||
| 33 | 33 | |
| 34 | 34 | class ClearNotifications implements IEventListener { |
| 35 | 35 | |
| 36 | - /** @var IManager */ |
|
| 37 | - private $manager; |
|
| 38 | - |
|
| 39 | - public function __construct(IManager $manager) { |
|
| 40 | - $this->manager = $manager; |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - public function handle(Event $event): void { |
|
| 44 | - if (!($event instanceof CodesGenerated)) { |
|
| 45 | - return; |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - $notification = $this->manager->createNotification(); |
|
| 49 | - $notification->setApp('twofactor_backupcodes') |
|
| 50 | - ->setUser($event->getUser()->getUID()) |
|
| 51 | - ->setObject('create', 'codes'); |
|
| 52 | - $this->manager->markProcessed($notification); |
|
| 53 | - } |
|
| 36 | + /** @var IManager */ |
|
| 37 | + private $manager; |
|
| 38 | + |
|
| 39 | + public function __construct(IManager $manager) { |
|
| 40 | + $this->manager = $manager; |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + public function handle(Event $event): void { |
|
| 44 | + if (!($event instanceof CodesGenerated)) { |
|
| 45 | + return; |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + $notification = $this->manager->createNotification(); |
|
| 49 | + $notification->setApp('twofactor_backupcodes') |
|
| 50 | + ->setUser($event->getUser()->getUID()) |
|
| 51 | + ->setObject('create', 'codes'); |
|
| 52 | + $this->manager->markProcessed($notification); |
|
| 53 | + } |
|
| 54 | 54 | } |