diff --git a/docs/API-Nextcloud.md b/docs/API-Nextcloud.md index a8a59d2af..8f50fe57c 100644 --- a/docs/API-Nextcloud.md +++ b/docs/API-Nextcloud.md @@ -1,5 +1,34 @@ # Nextcloud APIs +## Capabilities + +The [Nextcloud Capabilities API](https://docs.nextcloud.com/server/latest/developer_manual/client_apis/OCS/ocs-api-overview.html#capabilities-api) provides the following information for the Deck app: + +- `version` Current version of the Deck app running +- `canCreateBoards` Ability of the current user to create new boards for themselves + +``` +{ + "ocs": { + "meta": { + "status": "ok", + "statuscode": 200, + "message": "OK" + }, + "data": { + "capabilities": { + "deck": { + "version": "0.8.0", + "canCreateBoards": true + }, + } + } + } +} +``` + + + ## Available sharees When sharing a board to a user, group or circle, the possible sharees can be obtained though the files_sharing API. diff --git a/lib/Capabilities.php b/lib/Capabilities.php index 1a7435236..6fb37eebc 100644 --- a/lib/Capabilities.php +++ b/lib/Capabilities.php @@ -23,10 +23,23 @@ namespace OCA\Deck; +use OCA\Deck\Service\PermissionService; +use OCP\App\IAppManager; use OCP\Capabilities\ICapability; class Capabilities implements ICapability { + /** @var IAppManager */ + private $appManager; + /** @var PermissionService */ + private $permissionService; + + + public function __construct(IAppManager $appManager, PermissionService $permissionService) { + $this->appManager = $appManager; + $this->permissionService = $permissionService; + } + /** * Function an app uses to return the capabilities * @@ -36,7 +49,8 @@ class Capabilities implements ICapability { public function getCapabilities() { return [ 'deck' => [ - 'version' => \OC::$server->getAppManager()->getAppVersion('deck') + 'version' => $this->appManager->getAppVersion('deck'), + 'canCreateBoards' => $this->permissionService->canCreate() ] ]; }