Cleanup appinfo usage

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2021-02-16 15:51:25 +01:00
parent be0002d096
commit 89d2eaca0a
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
2 changed files with 10 additions and 13 deletions

View File

@ -32,6 +32,7 @@ declare(strict_types=1);
namespace OCA\Provisioning_API\Controller;
use OC\Accounts\AccountManager;
use OC\Group\Manager;
use OC\User\Backend;
use OC\User\NoUserException;
use OC_Helper;
@ -55,7 +56,7 @@ abstract class AUserData extends OCSController {
protected $userManager;
/** @var IConfig */
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;
/** @var IUserSession */
protected $userSession;
@ -182,7 +183,7 @@ abstract class AUserData extends OCSController {
/**
* @param string $userId
* @return array
* @throws \OCP\Files\NotFoundException
* @throws OCSException
*/
protected function fillStorageInfo(string $userId): array {
try {

View File

@ -31,6 +31,7 @@ declare(strict_types=1);
namespace OCA\Provisioning_API\Controller;
use OC_App;
use OCP\API;
use OCP\App\AppPathNotFoundException;
use OCP\App\IAppManager;
use OCP\AppFramework\Http\DataResponse;
@ -39,14 +40,9 @@ use OCP\AppFramework\OCSController;
use OCP\IRequest;
class AppsController extends OCSController {
/** @var \OCP\App\IAppManager */
/** @var IAppManager */
private $appManager;
/**
* @param string $appName
* @param IRequest $request
* @param IAppManager $appManager
*/
public function __construct(
string $appName,
IRequest $request,
@ -58,7 +54,7 @@ class AppsController extends OCSController {
}
/**
* @param string $filter
* @param string|null $filter
* @return DataResponse
* @throws OCSException
*/
@ -92,12 +88,12 @@ class AppsController extends OCSController {
* @throws OCSException
*/
public function getAppInfo(string $app): DataResponse {
$info = \OCP\App::getAppInfo($app);
$info = $this->appManager->getAppInfo($app);
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 {
$this->appManager->enableApp($app);
} 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();
}