Skip to content

Commit

Permalink
add capability
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiasKaminsky committed Dec 17, 2024
1 parent 458a540 commit c92b92b
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/


namespace OCA\Recommendations;

use OCA\Recommendations\AppInfo\Application;
use OCP\IConfig;
use OCP\IUserSession;
use OCP\Capabilities\ICapability;

class Capabilities implements ICapability {
private IUserSession $userSession;
private IConfig $config;

public function __construct(IUserSession $userSession,
IConfig $config) {
$this->userSession = $userSession;
$this->config = $config;
}

public function getCapabilities(): array {
$user = $this->userSession->getUser();
$enabled = $this->config->getUserValue($user->getUID(), Application::APP_ID, 'enabled', 'true') === 'true';

return ['recommendations' =>
[
'enabled' => $enabled
]
];
}
}

0 comments on commit c92b92b

Please sign in to comment.