Merge pull request #25681 from nextcloud/techdebt/noid/cleanup-provisioning
Cleanup appinfo usage
This commit is contained in:
commit
00d1a58a09
|
@ -32,6 +32,7 @@ declare(strict_types=1);
|
||||||
namespace OCA\Provisioning_API\Controller;
|
namespace OCA\Provisioning_API\Controller;
|
||||||
|
|
||||||
use OC\Accounts\AccountManager;
|
use OC\Accounts\AccountManager;
|
||||||
|
use OC\Group\Manager;
|
||||||
use OC\User\Backend;
|
use OC\User\Backend;
|
||||||
use OC\User\NoUserException;
|
use OC\User\NoUserException;
|
||||||
use OC_Helper;
|
use OC_Helper;
|
||||||
|
@ -55,7 +56,7 @@ abstract class AUserData extends OCSController {
|
||||||
protected $userManager;
|
protected $userManager;
|
||||||
/** @var IConfig */
|
/** @var IConfig */
|
||||||
protected $config;
|
protected $config;
|
||||||
/** @var IGroupManager|\OC\Group\Manager */ // FIXME Requires a method that is not on the interface
|
/** @var IGroupManager|Manager */ // FIXME Requires a method that is not on the interface
|
||||||
protected $groupManager;
|
protected $groupManager;
|
||||||
/** @var IUserSession */
|
/** @var IUserSession */
|
||||||
protected $userSession;
|
protected $userSession;
|
||||||
|
@ -182,7 +183,7 @@ abstract class AUserData extends OCSController {
|
||||||
/**
|
/**
|
||||||
* @param string $userId
|
* @param string $userId
|
||||||
* @return array
|
* @return array
|
||||||
* @throws \OCP\Files\NotFoundException
|
* @throws OCSException
|
||||||
*/
|
*/
|
||||||
protected function fillStorageInfo(string $userId): array {
|
protected function fillStorageInfo(string $userId): array {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -31,6 +31,7 @@ declare(strict_types=1);
|
||||||
namespace OCA\Provisioning_API\Controller;
|
namespace OCA\Provisioning_API\Controller;
|
||||||
|
|
||||||
use OC_App;
|
use OC_App;
|
||||||
|
use OCP\API;
|
||||||
use OCP\App\AppPathNotFoundException;
|
use OCP\App\AppPathNotFoundException;
|
||||||
use OCP\App\IAppManager;
|
use OCP\App\IAppManager;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
|
@ -39,14 +40,9 @@ use OCP\AppFramework\OCSController;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
|
|
||||||
class AppsController extends OCSController {
|
class AppsController extends OCSController {
|
||||||
/** @var \OCP\App\IAppManager */
|
/** @var IAppManager */
|
||||||
private $appManager;
|
private $appManager;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $appName
|
|
||||||
* @param IRequest $request
|
|
||||||
* @param IAppManager $appManager
|
|
||||||
*/
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
string $appName,
|
string $appName,
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
|
@ -58,7 +54,7 @@ class AppsController extends OCSController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $filter
|
* @param string|null $filter
|
||||||
* @return DataResponse
|
* @return DataResponse
|
||||||
* @throws OCSException
|
* @throws OCSException
|
||||||
*/
|
*/
|
||||||
|
@ -92,12 +88,12 @@ class AppsController extends OCSController {
|
||||||
* @throws OCSException
|
* @throws OCSException
|
||||||
*/
|
*/
|
||||||
public function getAppInfo(string $app): DataResponse {
|
public function getAppInfo(string $app): DataResponse {
|
||||||
$info = \OCP\App::getAppInfo($app);
|
$info = $this->appManager->getAppInfo($app);
|
||||||
if (!is_null($info)) {
|
if (!is_null($info)) {
|
||||||
return new DataResponse(OC_App::getAppInfo($app));
|
return new DataResponse($info);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new OCSException('The request app was not found', \OCP\API::RESPOND_NOT_FOUND);
|
throw new OCSException('The request app was not found', API::RESPOND_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,7 +106,7 @@ class AppsController extends OCSController {
|
||||||
try {
|
try {
|
||||||
$this->appManager->enableApp($app);
|
$this->appManager->enableApp($app);
|
||||||
} catch (AppPathNotFoundException $e) {
|
} catch (AppPathNotFoundException $e) {
|
||||||
throw new OCSException('The request app was not found', \OCP\API::RESPOND_NOT_FOUND);
|
throw new OCSException('The request app was not found', API::RESPOND_NOT_FOUND);
|
||||||
}
|
}
|
||||||
return new DataResponse();
|
return new DataResponse();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue