Skip to content

Commit

Permalink
feat: Add team resource providers capability
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <chrng8@gmail.com>
  • Loading branch information
Pytal committed Jan 13, 2025
1 parent 08a08b1 commit 222baf6
Showing 1 changed file with 27 additions and 1 deletion.
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 @@ public function getCapabilities(bool $complete = false): array {
'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 @@ private function getCapabilitiesMemberConstants(): array {
]
];
}

/**
* @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;
}
}

0 comments on commit 222baf6

Please sign in to comment.