Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/Commands/Connect.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
class Connect extends Command {

public function __construct(
private IUserManager $userManager,
private CoreService $CoreService,
private readonly IUserManager $userManager,
private readonly CoreService $CoreService,
) {
parent::__construct();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Commands/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
*/
class Debug extends Command {
public function __construct(
private IUserManager $userManager,
private ServicesService $servicesService,
private readonly IUserManager $userManager,
private readonly ServicesService $servicesService,
) {
parent::__construct();
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Commands/Disconnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
class Disconnect extends Command {

public function __construct(
private IUserManager $userManager,
private CoreService $CoreService,
private ServicesService $servicesService,
private readonly IUserManager $userManager,
private readonly CoreService $CoreService,
private readonly ServicesService $servicesService,
) {
parent::__construct();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Commands/Harmonize.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
class Harmonize extends Command {

public function __construct(
private IUserManager $userManager,
private HarmonizationService $HarmonizationService,
private readonly IUserManager $userManager,
private readonly HarmonizationService $HarmonizationService,
) {
parent::__construct();
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Commands/Show.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
class Show extends Command {

public function __construct(
private IUserManager $userManager,
private ServicesService $servicesService,
private readonly IUserManager $userManager,
private readonly ServicesService $servicesService,
) {
parent::__construct();
}
Expand Down
12 changes: 5 additions & 7 deletions lib/Controller/AdminConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@
*/
class AdminConfigurationController extends Controller {

private ConfigurationService $ConfigurationService;

public function __construct(string $appName, IRequest $request, ConfigurationService $ConfigurationService) {

public function __construct(
string $appName,
IRequest $request,
private readonly ConfigurationService $ConfigurationService,
) {
parent::__construct($appName, $request);

$this->ConfigurationService = $ConfigurationService;

}

/**
Expand Down
5 changes: 1 addition & 4 deletions lib/Controller/AdminTemplateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AdminTemplateController extends Controller {
public function __construct(
string $appName,
IRequest $request,
private ServicesTemplateService $templateService,
private readonly ServicesTemplateService $templateService,
) {
parent::__construct($appName, $request);
}
Expand All @@ -37,7 +37,6 @@ public function __construct(
*/
#[FrontpageRoute(verb: 'GET', url: '/admin/templates')]
public function list(): DataResponse {

return new DataResponse($this->templateService->list());
}

Expand All @@ -51,7 +50,6 @@ public function list(): DataResponse {
*/
#[FrontpageRoute(verb: 'POST', url: '/admin/templates/create')]
public function create(string $domain, array $connection = []): DataResponse {

$domain = trim($domain);
if (!Validator::fqdn($domain)) {
return new DataResponse('Invalid domain provided.', Http::STATUS_BAD_REQUEST);
Expand All @@ -73,7 +71,6 @@ public function create(string $domain, array $connection = []): DataResponse {
*/
#[FrontpageRoute(verb: 'POST', url: '/admin/templates/modify')]
public function modify(string $id, string $domain, array $connection = []): DataResponse {

$domain = trim($domain);
if ($id === '') {
return new DataResponse('Invalid template id.', Http::STATUS_BAD_REQUEST);
Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/UserConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ class UserConfigurationController extends Controller {
public function __construct(
string $appName,
IRequest $request,
private CoreService $CoreService,
private HarmonizationService $HarmonizationService,
private ServicesService $ServicesService,
private readonly CoreService $CoreService,
private readonly HarmonizationService $HarmonizationService,
private readonly ServicesService $ServicesService,
private ?string $userId,
) {
parent::__construct($appName, $request);
Expand Down
6 changes: 3 additions & 3 deletions lib/Events/UserDeletedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
class UserDeletedListener implements IEventListener {

public function __construct(
private LoggerInterface $logger,
private ServicesService $servicesService,
private CoreService $coreService,
private readonly LoggerInterface $logger,
private readonly ServicesService $servicesService,
private readonly CoreService $coreService,
) {
}

Expand Down
1 change: 0 additions & 1 deletion lib/Logging/FileLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
final class FileLogger implements LoggerInterface {
public function __construct(
private string $path,
private ?string $app = null,
) {
}

Expand Down
5 changes: 1 addition & 4 deletions lib/Migration/DefaultServiceTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class DefaultServiceTemplates implements IRepairStep {

public function __construct(
private ServicesTemplateStore $store,
private readonly ServicesTemplateStore $store,
) {
}

Expand All @@ -28,9 +28,6 @@ public function getName(): string {
return 'Create or update default Dav Connector service templates';
}

/**
* @return void
*/
#[\Override]
public function run(IOutput $output) {
// load the default service templates from file
Expand Down
6 changes: 0 additions & 6 deletions lib/Migration/Version0010Date20260501000001.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

Expand All @@ -21,11 +20,6 @@
*/
class Version0010Date20260501000001 extends SimpleMigrationStep {

public function __construct(
private IDBConnection $db,
) {
}

/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
Expand Down
38 changes: 7 additions & 31 deletions lib/Service/CoreService.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,11 @@

namespace OCA\DAVC\Service;

use DateTime;
use OCA\DAVC\AppInfo\Application;
use OCA\DAVC\Constants;
use OCA\DAVC\Service\Local\LocalFactory;
use OCA\DAVC\Service\Remote\RemoteFactory;
use OCA\DAVC\Store\Local\ServiceEntity;
use OCP\BackgroundJob\IJobList;
use OCP\Notification\IManager as INotificationManager;
use Psr\Log\LoggerInterface;
use Throwable;

Expand All @@ -26,14 +23,13 @@

class CoreService {
public function __construct(
private LoggerInterface $logger,
private IJobList $TaskService,
private INotificationManager $notificationManager,
private ConfigurationService $ConfigurationService,
private ServicesService $ServicesService,
private ServicesTemplateService $ServicesTemplateService,
private RemoteFactory $remoteFactory,
private LocalFactory $localFactory,
private readonly LoggerInterface $logger,
private readonly IJobList $TaskService,
private readonly ConfigurationService $ConfigurationService,
private readonly ServicesService $ServicesService,
private readonly ServicesTemplateService $ServicesTemplateService,
private readonly RemoteFactory $remoteFactory,
private readonly LocalFactory $localFactory,
) {
}

Expand Down Expand Up @@ -483,24 +479,4 @@ public function localCollectionsDeposit(string $uid, int $sid, array $cc, array
}
}

/**
* publish user notification
*
* @param string $uid nextcloud user id
* @param string $subject notification type
* @param array $params notification parameters to pass
*/
public function publishNotice(string $uid, string $subject, array $params): void {
// construct notification object
$notification = $this->notificationManager->createNotification();
// assign attributes
$notification->setApp(Application::APP_ID)
->setUser($uid)
->setDateTime(new DateTime())
->setObject('eas', 'eas')
->setSubject($subject, $params);
// submit notification
$this->notificationManager->notify($notification);
}

}
12 changes: 6 additions & 6 deletions lib/Service/HarmonizationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

class HarmonizationService {
public function __construct(
private LoggerInterface $logger,
private ConfigurationService $configurationService,
private ServicesService $servicesService,
private ContactsService $contactsService,
private EventsService $eventsService,
private RemoteFactory $remoteFactory,
private readonly LoggerInterface $logger,
private readonly ConfigurationService $configurationService,
private readonly ServicesService $servicesService,
private readonly ContactsService $contactsService,
private readonly EventsService $eventsService,
private readonly RemoteFactory $remoteFactory,
) {
}

Expand Down
16 changes: 3 additions & 13 deletions lib/Service/Remote/RemoteFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ class RemoteFactory {
public static string $clientTransportAgent = 'NextcloudDAVC/1.0 (1.0; x64)';

public function __construct(
private IClientService $clientService,
private IConfig $config,
private ConfigurationService $configurationService,
private readonly IClientService $clientService,
private readonly IConfig $config,
private readonly ConfigurationService $configurationService,
) {
}

Expand Down Expand Up @@ -76,16 +76,6 @@ private function logger(ServiceEntity $service): LoggerInterface {
return new FileLogger($path);
}

/**
* Appropriate Core Service for Connection
*/
public function coreService(RemoteClient $client): RemoteCoreService {
$service = new RemoteCoreService();
$service->initialize($client);

return $service;
}

/**
* Appropriate Contacts Service for Connection
*/
Expand Down
7 changes: 0 additions & 7 deletions lib/Service/ServicesTemplateService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@ class ServicesTemplateService {
private ServicesTemplateStore $_Store;

public function __construct(ServicesTemplateStore $store) {

$this->_Store = $store;

}

public function findByDomain(string $domain): array {

return $this->_Store->fetchByDomain($domain);
}

Expand All @@ -32,7 +29,6 @@ public function findByDomain(string $domain): array {
* @return array
*/
public function list(): array {

return array_map(static function (array $template): array {
$template['connection'] = json_decode((string)$template['connection'], true) ?: [];
return $template;
Expand All @@ -48,7 +44,6 @@ public function list(): array {
* @return bool
*/
public function create(string $domain, array $connection): bool {

return $this->_Store->create(UUID::v4(), $domain, $connection);
}

Expand All @@ -62,7 +57,6 @@ public function create(string $domain, array $connection): bool {
* @return bool
*/
public function modify(string $id, string $domain, array $connection): bool {

return $this->_Store->modify($id, $domain, $connection);
}

Expand All @@ -74,7 +68,6 @@ public function modify(string $id, string $domain, array $connection): bool {
* @return bool
*/
public function delete(string $id): bool {

return $this->_Store->delete($id);
}

Expand Down
32 changes: 4 additions & 28 deletions lib/Settings/AdminSection.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,27 @@
*/
class AdminSection implements IIconSection {

/** @var IL10N */
private $l;

/** @var IURLGenerator */
private $urlGenerator;

public function __construct(IURLGenerator $urlGenerator, IL10N $l) {
$this->l = $l;
$this->urlGenerator = $urlGenerator;
public function __construct(
private readonly IURLGenerator $urlGenerator,
private readonly IL10N $l,
) {
}

/**
* returns the ID of the section. It is supposed to be a lower case string
*
* @returns string
*/
#[\Override]
public function getID(): string {
return 'integration-davc';
}

/**
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
* integration'. Use the L10N service to translate it.
*
* @return string
*/
#[\Override]
public function getName(): string {
return $this->l->t('DAV Connector');
}

/**
* @return int whether the form should be rather on the top or bottom of
* the settings navigation. The sections are arranged in ascending order of
* the priority values. It is required to return a value between 0 and 99.
*/
#[\Override]
public function getPriority(): int {
return 80;
}

/**
* @return ?string The relative path to a an icon describing the section
*/
#[\Override]
public function getIcon(): ?string {
return $this->urlGenerator->imagePath('core', 'categories/integration.svg');
Expand Down
Loading
Loading