99
1010namespace OCA \Circles \Controller ;
1111
12+ use OCA \Circles \ConfigLexicon ;
1213use OCA \Circles \Service \ConfigService ;
1314use OCP \AppFramework \Http ;
1415use OCP \AppFramework \Http \DataResponse ;
@@ -26,16 +27,16 @@ public function __construct(
2627 }
2728
2829 public function setValue (string $ key , string $ value ): DataResponse {
29- if ($ key === ' frontal_cloud ' ) {
30+ if ($ key === ConfigLexicon:: FEDERATED_TEAMS_FRONTAL ) {
3031 if ($ this ->setFrontalValue ($ value )) {
3132 return $ this ->getValues ();
3233 }
3334
3435 return new DataResponse (['data ' => ['message ' => 'wrongly formated value ' ]], Http::STATUS_BAD_REQUEST );
3536 }
3637
37- if ($ key === ' federated_teams_enabled ' ) {
38- $ this ->appConfig ->setAppValueBool (' federated_teams_enabled ' , $ value === 'yes ' );
38+ if ($ key === ConfigLexicon:: FEDERATED_TEAMS_ENABLED ) {
39+ $ this ->appConfig ->setAppValueBool (ConfigLexicon:: FEDERATED_TEAMS_ENABLED , $ value === 'yes ' );
3940 return $ this ->getValues ();
4041 }
4142
@@ -44,8 +45,8 @@ public function setValue(string $key, string $value): DataResponse {
4445
4546 public function getValues (): DataResponse {
4647 return new DataResponse ([
47- ' frontal_cloud ' => $ this ->getFrontalValue () ?? '' ,
48- ' federated_teams_enabled ' => $ this ->appConfig ->getAppValueBool (' federated_teams_enabled ' ),
48+ ConfigLexicon:: FEDERATED_TEAMS_FRONTAL => $ this ->getFrontalValue () ?? '' ,
49+ ConfigLexicon:: FEDERATED_TEAMS_ENABLED => $ this ->appConfig ->getAppValueBool (ConfigLexicon:: FEDERATED_TEAMS_ENABLED ),
4950 ]);
5051 }
5152
@@ -55,6 +56,7 @@ private function setFrontalValue(string $url): bool {
5556 return false ;
5657 }
5758
59+ $ this ->appConfig ->setAppValueString (ConfigLexicon::FEDERATED_TEAMS_FRONTAL , $ url );
5860 $ this ->appConfig ->setAppValueString (ConfigService::FRONTAL_CLOUD_SCHEME , $ scheme );
5961 $ this ->appConfig ->setAppValueString (ConfigService::FRONTAL_CLOUD_ID , $ cloudId );
6062 $ this ->appConfig ->setAppValueString (ConfigService::FRONTAL_CLOUD_PATH , $ path );
@@ -63,6 +65,10 @@ private function setFrontalValue(string $url): bool {
6365 }
6466
6567 private function getFrontalValue (): ?string {
68+ if ($ this ->appConfig ->hasAppKey (ConfigLexicon::FEDERATED_TEAMS_FRONTAL )) {
69+ return $ this ->appConfig ->getAppValueString (ConfigLExicon::FEDERATED_TEAMS_FRONTAL );
70+ }
71+
6672 if (!$ this ->appConfig ->hasAppKey (ConfigService::FRONTAL_CLOUD_SCHEME )
6773 || !$ this ->appConfig ->hasAppKey (ConfigService::FRONTAL_CLOUD_ID )
6874 || !$ this ->appConfig ->hasAppKey (ConfigService::FRONTAL_CLOUD_PATH )) {
0 commit comments