Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add team resource providers capability #1839

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion lib/AppInfo/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,26 @@

namespace OCA\Circles\AppInfo;

use OC\AppFramework\Bootstrap\Coordinator;
use OC\AppFramework\Bootstrap\ServiceRegistration;
use OCA\Circles\Model\Circle;
use OCA\Circles\Model\Member;
use OCA\Circles\Service\ConfigService;
use OCA\Circles\Service\InterfaceService;
use OCP\App\IAppManager;
use OCP\Capabilities\ICapability;
use OCP\IL10N;
use OCP\Teams\ITeamResourceProvider;
use Psr\Container\ContainerInterface;

class Capabilities implements ICapability {
public function __construct(
private IL10N $l10n,
private IAppManager $appManager,
private InterfaceService $interfaceService,
private ConfigService $configService,
private Coordinator $coordinator,

Check failure on line 30 in lib/AppInfo/Capabilities.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedClass

lib/AppInfo/Capabilities.php:30:3: UndefinedClass: Class, interface or enum named OC\AppFramework\Bootstrap\Coordinator does not exist (see https://psalm.dev/019)
private ContainerInterface $container,
) {
}

Expand All @@ -33,7 +39,8 @@
'status' => $this->getCapabilitiesStatus($complete),
'settings' => $this->configService->getSettings(),
'circle' => $this->getCapabilitiesCircle(),
'member' => $this->getCapabilitiesMember()
'member' => $this->getCapabilitiesMember(),
'teamResourceProviders' => $this->getCapabilitiesTeamResourceProviders(),
],
];
}
Expand Down Expand Up @@ -143,4 +150,23 @@
]
];
}

/**
* @return string[]
*/
private function getCapabilitiesTeamResourceProviders() {
$providers = $this->coordinator->getRegistrationContext()?->getTeamResourceProviders();

Check failure on line 158 in lib/AppInfo/Capabilities.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedClass

lib/AppInfo/Capabilities.php:158:16: UndefinedClass: Class, interface or enum named OC\AppFramework\Bootstrap\Coordinator does not exist (see https://psalm.dev/019)
if ($providers === null) {
return [];
}
$providerIds = array_map(
function (ServiceRegistration $registration) {

Check failure on line 163 in lib/AppInfo/Capabilities.php

View workflow job for this annotation

GitHub Actions / static-psalm-analysis

UndefinedClass

lib/AppInfo/Capabilities.php:163:14: UndefinedClass: Class, interface or enum named OC\AppFramework\Bootstrap\ServiceRegistration does not exist (see https://psalm.dev/019)
/** @var ITeamResourceProvider $provider */
$provider = $this->container->get($registration->getService());
return $provider->getId();
},
$providers,
);
return $providerIds;
}
}
Loading