Add capability for editable scopes in provisioning API
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
This commit is contained in:
parent
b73df5846c
commit
b66af8a432
|
@ -8,6 +8,7 @@ $baseDir = $vendorDir;
|
||||||
return array(
|
return array(
|
||||||
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
||||||
'OCA\\Provisioning_API\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
|
'OCA\\Provisioning_API\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php',
|
||||||
|
'OCA\\Provisioning_API\\Capabilities' => $baseDir . '/../lib/Capabilities.php',
|
||||||
'OCA\\Provisioning_API\\Controller\\AUserData' => $baseDir . '/../lib/Controller/AUserData.php',
|
'OCA\\Provisioning_API\\Controller\\AUserData' => $baseDir . '/../lib/Controller/AUserData.php',
|
||||||
'OCA\\Provisioning_API\\Controller\\AppConfigController' => $baseDir . '/../lib/Controller/AppConfigController.php',
|
'OCA\\Provisioning_API\\Controller\\AppConfigController' => $baseDir . '/../lib/Controller/AppConfigController.php',
|
||||||
'OCA\\Provisioning_API\\Controller\\AppsController' => $baseDir . '/../lib/Controller/AppsController.php',
|
'OCA\\Provisioning_API\\Controller\\AppsController' => $baseDir . '/../lib/Controller/AppsController.php',
|
||||||
|
|
|
@ -23,6 +23,7 @@ class ComposerStaticInitProvisioning_API
|
||||||
public static $classMap = array (
|
public static $classMap = array (
|
||||||
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
||||||
'OCA\\Provisioning_API\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
|
'OCA\\Provisioning_API\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php',
|
||||||
|
'OCA\\Provisioning_API\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php',
|
||||||
'OCA\\Provisioning_API\\Controller\\AUserData' => __DIR__ . '/..' . '/../lib/Controller/AUserData.php',
|
'OCA\\Provisioning_API\\Controller\\AUserData' => __DIR__ . '/..' . '/../lib/Controller/AUserData.php',
|
||||||
'OCA\\Provisioning_API\\Controller\\AppConfigController' => __DIR__ . '/..' . '/../lib/Controller/AppConfigController.php',
|
'OCA\\Provisioning_API\\Controller\\AppConfigController' => __DIR__ . '/..' . '/../lib/Controller/AppConfigController.php',
|
||||||
'OCA\\Provisioning_API\\Controller\\AppsController' => __DIR__ . '/..' . '/../lib/Controller/AppsController.php',
|
'OCA\\Provisioning_API\\Controller\\AppsController' => __DIR__ . '/..' . '/../lib/Controller/AppsController.php',
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
namespace OCA\Provisioning_API\AppInfo;
|
namespace OCA\Provisioning_API\AppInfo;
|
||||||
|
|
||||||
use OC\Group\Manager as GroupManager;
|
use OC\Group\Manager as GroupManager;
|
||||||
|
use OCA\Provisioning_API\Capabilities;
|
||||||
use OCA\Provisioning_API\Listener\UserDeletedListener;
|
use OCA\Provisioning_API\Listener\UserDeletedListener;
|
||||||
use OCA\Provisioning_API\Middleware\ProvisioningApiMiddleware;
|
use OCA\Provisioning_API\Middleware\ProvisioningApiMiddleware;
|
||||||
use OCA\Settings\Mailer\NewUserMailHelper;
|
use OCA\Settings\Mailer\NewUserMailHelper;
|
||||||
|
@ -92,6 +93,7 @@ class Application extends App implements IBootstrap {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
$context->registerMiddleware(ProvisioningApiMiddleware::class);
|
$context->registerMiddleware(ProvisioningApiMiddleware::class);
|
||||||
|
$context->registerCapability(Capabilities::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function boot(IBootContext $context): void {
|
public function boot(IBootContext $context): void {
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2021 Vincent Petry <vincent@nextcloud.com>
|
||||||
|
*
|
||||||
|
* @author Vincent Petry <vincent@nextcloud.com>
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace OCA\Provisioning_API;
|
||||||
|
|
||||||
|
use OCP\App\IAppManager;
|
||||||
|
use OCP\Capabilities\ICapability;
|
||||||
|
|
||||||
|
class Capabilities implements ICapability {
|
||||||
|
|
||||||
|
/** @var IAppManager */
|
||||||
|
private $appManager;
|
||||||
|
|
||||||
|
public function __construct(IAppManager $appManager) {
|
||||||
|
$this->appManager = $appManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function an app uses to return the capabilities
|
||||||
|
*
|
||||||
|
* @return array Array containing the apps capabilities
|
||||||
|
*/
|
||||||
|
public function getCapabilities() {
|
||||||
|
return [
|
||||||
|
'provisioning_api' => [
|
||||||
|
'version' => $this->appManager->getAppVersion('provisioning_api'),
|
||||||
|
'hasAccountPropertyScopes' => true,
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue