Add canCreateBoards to capabilities and update documentation
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -1,5 +1,34 @@
|
|||||||
# Nextcloud APIs
|
# 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
|
## Available sharees
|
||||||
|
|
||||||
When sharing a board to a user, group or circle, the possible sharees can be obtained though the files_sharing API.
|
When sharing a board to a user, group or circle, the possible sharees can be obtained though the files_sharing API.
|
||||||
|
|||||||
@@ -23,10 +23,23 @@
|
|||||||
|
|
||||||
namespace OCA\Deck;
|
namespace OCA\Deck;
|
||||||
|
|
||||||
|
use OCA\Deck\Service\PermissionService;
|
||||||
|
use OCP\App\IAppManager;
|
||||||
use OCP\Capabilities\ICapability;
|
use OCP\Capabilities\ICapability;
|
||||||
|
|
||||||
class Capabilities implements 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
|
* Function an app uses to return the capabilities
|
||||||
*
|
*
|
||||||
@@ -36,7 +49,8 @@ class Capabilities implements ICapability {
|
|||||||
public function getCapabilities() {
|
public function getCapabilities() {
|
||||||
return [
|
return [
|
||||||
'deck' => [
|
'deck' => [
|
||||||
'version' => \OC::$server->getAppManager()->getAppVersion('deck')
|
'version' => $this->appManager->getAppVersion('deck'),
|
||||||
|
'canCreateBoards' => $this->permissionService->canCreate()
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user