99
1010namespace OCA \Circles \AppInfo ;
1111
12+ use OC \AppFramework \Bootstrap \Coordinator ;
13+ use OC \AppFramework \Bootstrap \ServiceRegistration ;
1214use OCA \Circles \Model \Circle ;
1315use OCA \Circles \Model \Member ;
1416use OCA \Circles \Service \ConfigService ;
1517use OCA \Circles \Service \InterfaceService ;
1618use OCP \App \IAppManager ;
1719use OCP \Capabilities \ICapability ;
1820use OCP \IL10N ;
21+ use OCP \Teams \ITeamResourceProvider ;
22+ use Psr \Container \ContainerInterface ;
1923
2024class Capabilities implements ICapability {
2125 public function __construct (
2226 private IL10N $ l10n ,
2327 private IAppManager $ appManager ,
2428 private InterfaceService $ interfaceService ,
2529 private ConfigService $ configService ,
30+ private Coordinator $ coordinator ,
31+ private ContainerInterface $ container ,
2632 ) {
2733 }
2834
@@ -33,7 +39,8 @@ public function getCapabilities(bool $complete = false): array {
3339 'status ' => $ this ->getCapabilitiesStatus ($ complete ),
3440 'settings ' => $ this ->configService ->getSettings (),
3541 'circle ' => $ this ->getCapabilitiesCircle (),
36- 'member ' => $ this ->getCapabilitiesMember ()
42+ 'member ' => $ this ->getCapabilitiesMember (),
43+ 'teamResourceProviders ' => $ this ->getCapabilitiesTeamResourceProviders (),
3744 ],
3845 ];
3946 }
@@ -143,4 +150,23 @@ private function getCapabilitiesMemberConstants(): array {
143150 ]
144151 ];
145152 }
153+
154+ /**
155+ * @return string[]
156+ */
157+ private function getCapabilitiesTeamResourceProviders () {
158+ $ providers = $ this ->coordinator ->getRegistrationContext ()?->getTeamResourceProviders();
159+ if ($ providers === null ) {
160+ return [];
161+ }
162+ $ providerIds = array_map (
163+ function (ServiceRegistration $ registration ) {
164+ /** @var ITeamResourceProvider $provider */
165+ $ provider = $ this ->container ->get ($ registration ->getService ());
166+ return $ provider ->getId ();
167+ },
168+ $ providers ,
169+ );
170+ return $ providerIds ;
171+ }
146172}
0 commit comments