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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ nbproject
clover.xml

/.php_cs.cache

.php-cs-fixer.cache
4 changes: 1 addition & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
<?php

declare(strict_types=1);

/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

require_once './vendor-bin/csfixer/vendor/autoload.php';

use Nextcloud\CodingStandard\Config;

$config = new Config();
$config
->getFinder()
->ignoreVCSIgnored(true)
->notPath('build')
->notPath('tests/stubs')
->notPath('l10n')
->notPath('src')
->notPath('vendor')
->notPath('vendor-bin')
->notPath('lib/Vendor')
->in(__DIR__);
return $config;
1 change: 0 additions & 1 deletion appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/


return [
'ocs' => [
['name' => 'Slave#createAppToken', 'url' => '/v1/createapptoken', 'verb' => 'GET'],
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"require": {
"bamarni/composer-bin-plugin": "^1.8",
"firebase/php-jwt": "^6.8"
"firebase/php-jwt": "^7.0"
},
"extra": {
"bamarni-bin": {
Expand All @@ -65,7 +65,7 @@
}
},
"require-dev": {
"nextcloud/ocp": "dev-master"
"nextcloud/ocp": "dev-stable32"
},
"autoload-dev": {
"psr-4": {
Expand Down
35 changes: 17 additions & 18 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ public function __construct(array $urlParams = []) {
parent::__construct(self::APP_ID, $urlParams);
}


/**
* @param IRegistrationContext $context
*/
#[\Override]
public function register(IRegistrationContext $context): void {
$context->registerCapability(PublicCapabilities::class);

Expand Down Expand Up @@ -97,12 +97,12 @@ function (GenericEvent $event) {
);
}


/**
* @param IBootContext $context
*
* @throws Throwable
*/
#[\Override]
public function boot(IBootContext $context): void {
$this->globalSiteSelector = $context->getAppContainer()->get(GlobalSiteSelector::class);
$this->logger = $context->getServerContainer()->get(LoggerInterface::class);
Expand All @@ -111,7 +111,6 @@ public function boot(IBootContext $context): void {
$context->injectFn(Closure::fromCallable([$this, 'redirectToMasterLogin']));
}


/**
* Register the Global Scale User Backend if we run in slave mode
*/
Expand Down Expand Up @@ -139,7 +138,6 @@ private function registerUserBackendForSlave() {
$this->logger->debug('gss UserBackend registered', ['app' => self::APP_ID]);
}


/**
* Register the Global Scale User Backend if we run in slave mode
*/
Expand Down
2 changes: 2 additions & 0 deletions lib/BackgroundJobs/UpdateLookupServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\GlobalSiteSelector\BackgroundJobs;

use OCA\GlobalSiteSelector\GlobalSiteSelector;
Expand All @@ -30,6 +31,7 @@ public function __construct(
$this->setTimeSensitivity(IJob::TIME_SENSITIVE);
}

#[\Override]
protected function run($argument) {
if (!$this->globalSiteSelector->isSlave()) {
return;
Expand Down
3 changes: 3 additions & 0 deletions lib/Command/GlobalScaleDiscovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\GlobalSiteSelector\Command;

use OC\Core\Command\Base;
Expand All @@ -25,13 +26,15 @@ public function __construct(
parent::__construct();
}

#[\Override]
protected function configure(): void {
parent::configure();
$this->setName('globalsiteselector:discovery')
->addOption('current', '', InputOption::VALUE_NONE, 'display current data')
->setDescription('run a discovery request over Global Scale to get details about each instances');
}

#[\Override]
protected function execute(InputInterface $input, OutputInterface $output): int {
if ($input->getOption('current')) {
$output->writeln(json_encode($this->appConfig->getValueArray(Application::APP_ID, ConfigLexicon::GS_TOKENS), JSON_PRETTY_PRINT));
Expand Down
4 changes: 2 additions & 2 deletions lib/Command/UsersUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ public function __construct(Slave $slave) {
$this->slave = $slave;
}


/**
*
*/
#[\Override]
protected function configure() {
parent::configure();
$this->setName('globalsiteselector:users:update')
->setDescription('update known users data to Lookup Server');
}


/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int
*/
#[\Override]
protected function execute(InputInterface $input, OutputInterface $output): int {
$this->slave->batchUpdate();

Expand Down
4 changes: 4 additions & 0 deletions lib/ConfigLexicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/

namespace OCA\GlobalSiteSelector;

use OCP\Config\Lexicon\Entry;
Expand All @@ -17,13 +18,15 @@ class ConfigLexicon implements ILexicon {
public const GS_TOKENS = 'globalScaleTokens';
public const LOCAL_TOKEN = 'localToken';

#[\Override]
public function getStrictness(): Strictness {
return Strictness::IGNORE;
}

/**
* @inheritDoc
*/
#[\Override]
public function getAppConfigs(): array {
return [
new Entry(key: self::GS_TOKENS, type: ValueType::ARRAY, defaultRaw: [], definition: 'list of token+host to navigate through GlobalScale', lazy: true),
Expand All @@ -34,6 +37,7 @@ public function getAppConfigs(): array {
/**
* @inheritDoc
*/
#[\Override]
public function getUserConfigs(): array {
return [
];
Expand Down
2 changes: 0 additions & 2 deletions lib/Controller/MasterController.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?php


/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/


namespace OCA\GlobalSiteSelector\Controller;

use OCA\GlobalSiteSelector\AppInfo\Application;
Expand Down
3 changes: 0 additions & 3 deletions lib/Controller/SlaveController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* SPDX-License-Identifier: AGPL-3.0-or-later
*/


namespace OCA\GlobalSiteSelector\Controller;

use OC\Authentication\Token\IProvider;
Expand Down Expand Up @@ -123,7 +122,6 @@ public function sharedFile(string $jwt): DataResponse {
}
}


#[PublicPage]
#[NoCSRFRequired]
#[UseSession]
Expand Down Expand Up @@ -289,7 +287,6 @@ protected function decodeJwt($jwt) {
return [$uid, $password, json_decode($options, true)];
}


/**
* create new user if the user doesn't exist yet on the client node
*
Expand Down
4 changes: 0 additions & 4 deletions lib/GlobalSiteSelector.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class GlobalSiteSelector {
public const MASTER = 'master';
public const SLAVE = 'slave';


/** @var IConfig */
private $config;

Expand Down Expand Up @@ -59,7 +58,6 @@ public function isSlave(): bool {
return ($this->getMode() === self::SLAVE);
}


/**
* get JWT key
*
Expand All @@ -70,7 +68,6 @@ public function getJwtKey(): string {
return $this->config->getSystemValueString('gss.jwt.key', '');
}


/**
* get the URL of the global site selector master
*
Expand All @@ -86,7 +83,6 @@ public function getMasterUrl(): string {
return $masterUrl;
}


/**
* get lookup server URL
*
Expand Down
1 change: 1 addition & 0 deletions lib/Listeners/AddContentSecurityPolicyListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function __construct(
) {
}

#[\Override]
public function handle(Event $event): void {
if (!$event instanceof AddContentSecurityPolicyEvent) {
return;
Expand Down
1 change: 1 addition & 0 deletions lib/Listeners/DeletingUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function __construct(
/**
* @param Event $event
*/
#[\Override]
public function handle(Event $event): void {
if (!$event instanceof BeforeUserDeletedEvent) {
return;
Expand Down
2 changes: 1 addition & 1 deletion lib/Listeners/UserCreated.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ public function __construct(
) {
}


/**
* @param Event $event
*/
#[\Override]
public function handle(Event $event): void {
if (!$event instanceof UserCreatedEvent) {
return;
Expand Down
Loading
Loading