Skip to content

Commit

Permalink
Merge pull request #1100 from nextcloud/bugfix/noid/dont-break-hard
Browse files Browse the repository at this point in the history
fix(config): Fix constructor of config class
  • Loading branch information
nickvergessen authored Jan 18, 2024
2 parents 0e51d90 + 9b0a918 commit 4ea544d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-php-cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:
run: composer i

- name: Lint
run: composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )
run: PHP_CS_FIXER_IGNORE_ENV=1 composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Guests accounts can be created from the share menu by entering either the recipients email or name and choosing "create guest account", once the share is created the guest user will receive an email notification about the mail with a link to set their password.
Guests users can only access files shared to them and cannot create any files outside of shares, additionally, the apps accessible to guest accounts are whitelisted.]]></description>
<version>3.0.1</version>
<version>3.1.0</version>
<licence>agpl</licence>
<author>Nextcloud</author>
<types>
Expand All @@ -26,7 +26,7 @@ Guests users can only access files shared to them and cannot create any files ou
<screenshot>https://raw.githubusercontent.com/nextcloud/guests/master/screenshots/settings.png</screenshot>
<screenshot>https://raw.githubusercontent.com/nextcloud/guests/master/screenshots/dropdown.png</screenshot>
<dependencies>
<nextcloud min-version="28" max-version="28" />
<nextcloud min-version="29" max-version="29" />
</dependencies>
<commands>
<command>OCA\Guests\Command\ListCommand</command>
Expand Down
8 changes: 5 additions & 3 deletions lib/AppConfigOverwrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,20 @@
namespace OCA\Guests;

use OC\AppConfig;
use OC\DB\ConnectionAdapter;
use OCP\IDBConnection;
use Psr\Log\LoggerInterface;

class AppConfigOverwrite extends AppConfig {

/** @var string[][] */
private $overWrite;

public function __construct(
ConnectionAdapter $conn,
IDBConnection $connection,
LoggerInterface $logger,
array $overWrite
) {
parent::__construct($conn->getInner());
parent::__construct($connection, $logger);
$this->overWrite = $overWrite;
}

Expand Down
13 changes: 9 additions & 4 deletions lib/RestrictionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
use OCP\IUser;
use OCP\IUserSession;
use OCP\Settings\IManager;
use Psr\Log\LoggerInterface;

class RestrictionManager {
/** @var AppWhitelist */
Expand Down Expand Up @@ -119,11 +120,15 @@ public function lateSetupRestrictions(): void {
$this->userBackend->setAllowListing(false);

$this->server->registerService(AppConfig::class, function () {
return new AppConfigOverwrite($this->server->get(IDBConnection::class), [
'core' => [
'shareapi_only_share_with_group_members' => 'yes'
return new AppConfigOverwrite(
$this->server->get(IDBConnection::class),
$this->server->get(LoggerInterface::class),
[
'core' => [
'shareapi_only_share_with_group_members' => 'yes'
]
]
]);
);
});
}
}
Expand Down
9 changes: 8 additions & 1 deletion tests/stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,15 @@ public function setUnreadCounter(string $id, int $unreadCounter): void {
}

class AppConfig {
public function __construct(\OC\DB\Connection $connection) {
public function __construct(
protected \OCP\IDBConnection $connection,
private \Psr\Log\LoggerInterface $logger,
) {
}

/**
* @deprecated - use getValue*()
*/
public function getValue(string $app, string $key, string $default = null): string {
}
}
Expand Down

0 comments on commit 4ea544d

Please sign in to comment.