Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix navigation manager to be in line with server #1248

Merged
merged 3 commits into from
Oct 1, 2024
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
10 changes: 5 additions & 5 deletions composer.lock

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

19 changes: 19 additions & 0 deletions lib/FilteredNavigationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,23 @@ public function setActiveEntry($appId): void {
public function setUnreadCounter(string $id, int $unreadCounter): void {
$this->navigationManager->setUnreadCounter($id, $unreadCounter);
}

public function get(string $id): ?array {
return $this->navigationManager->get($id);
}

public function getDefaultEntryIdForUser(?IUser $user = null, bool $withFallbacks = true): string {
return $this->navigationManager->getDefaultEntryIdForUser($user, $withFallbacks);
}

public function getDefaultEntryIds(bool $withFallbacks = true): array {
return $this->navigationManager->getDefaultEntryIds($withFallbacks);
}

/**
* @psalm-suppress MethodSignatureMismatch
*/
public function setDefaultEntryIds(array $ids): void {
$this->navigationManager->setDefaultEntryIds($ids);
}
}
2 changes: 1 addition & 1 deletion lib/RestrictionManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function setupRestrictions(): void {
}

/** @var NavigationManager $navManager */
$navManager = $this->server->getNavigationManager();
$navManager = \OCP\Server::get(INavigationManager::class);

$this->server->registerService(INavigationManager::class, function () use ($navManager) {
return new FilteredNavigationManager($this->userSession->getUser(), $navManager, $this->whitelist);
Expand Down
25 changes: 4 additions & 21 deletions lib/Storage/DirMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace OCA\Guests\Storage;

use OC\Files\Storage\Wrapper\PermissionsMask;
use OCP\Files\Cache\ICache;

/**
* While PermissionMask can mask a whole storage this can
Expand Down Expand Up @@ -100,9 +101,6 @@ public function getPermissions($path): int {
}
}

/**
* @psalm-suppress ParamNameMismatch
*/
public function rename($source, $target): bool {
if (!$this->isUpdatable($source)) {
return false;
Expand All @@ -123,9 +121,6 @@ public function rename($source, $target): bool {
return false;
}

/**
* @psalm-suppress ParamNameMismatch
*/
public function copy($source, $target): bool {
if (!$this->isReadable($source)) {
return false;
Expand Down Expand Up @@ -162,10 +157,7 @@ public function mkdir($path): bool {
}
}

/**
* @psalm-suppress MethodSignatureMustProvideReturnType
*/
public function rmdir($path) {
public function rmdir($path): bool {
if ($this->checkPath($path)) {
return parent::rmdir($path);
} else {
Expand All @@ -181,20 +173,14 @@ public function unlink($path): bool {
}
}

/**
* @psalm-suppress MethodSignatureMustProvideReturnType
*/
public function file_put_contents($path, $data) {
public function file_put_contents($path, $data): int|float|false {
if ($this->checkPath($path)) {
return parent::file_put_contents($path, $data);
} else {
return $this->storage->file_put_contents($path, $data);
}
}

/**
* @psalm-suppress MethodSignatureMustProvideReturnType
*/
public function fopen($path, $mode) {
if ($this->checkPath($path)) {
return parent::fopen($path, $mode);
Expand All @@ -203,10 +189,7 @@ public function fopen($path, $mode) {
}
}

/**
* @psalm-suppress MethodSignatureMustProvideReturnType
*/
public function getCache($path = '', $storage = null) {
public function getCache($path = '', $storage = null): ICache {
if (!$storage) {
$storage = $this;
}
Expand Down
Loading
Loading