File tree Expand file tree Collapse file tree 5 files changed +120
-0
lines changed Expand file tree Collapse file tree 5 files changed +120
-0
lines changed Original file line number Diff line number Diff line change 1212use OCA \Registration \Events \PassedFormEvent ;
1313use OCA \Registration \Events \ShowFormEvent ;
1414use OCA \Registration \Events \ValidateFormEvent ;
15+ use OCA \TermsOfService \PublicCapabilities ;
1516use OCA \TermsOfService \Checker ;
1617use OCA \TermsOfService \Filesystem \StorageWrapper ;
1718use OCA \TermsOfService \Listener \RegistrationIntegration ;
@@ -51,6 +52,7 @@ public function register(IRegistrationContext $context): void {
5152 $ context ->registerEventListener (ShowFormEvent::class, RegistrationIntegration::class);
5253 $ context ->registerEventListener (ValidateFormEvent::class, RegistrationIntegration::class);
5354 $ context ->registerEventListener (PassedFormEvent::class, RegistrationIntegration::class);
55+ $ context ->registerCapability (PublicCapabilities::class);
5456 }
5557
5658 public function boot (IBootContext $ context ): void {
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ /**
6+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
7+ * SPDX-License-Identifier: AGPL-3.0-or-later
8+ */
9+
10+ namespace OCA \TermsOfService ;
11+
12+ use OCA \TermsOfService \AppInfo \Application ;
13+ use OCP \Capabilities \IPublicCapability ;
14+ use OCP \IConfig ;
15+
16+ class PublicCapabilities implements IPublicCapability {
17+ public function __construct (
18+ private IConfig $ config ,
19+ ) {
20+ }
21+
22+ /**
23+ * @return array{
24+ * terms_of_service: array{
25+ * enabled: true,
26+ * term_uuid: string,
27+ * },
28+ * }
29+ */
30+ public function getCapabilities (): array {
31+ $ termId = $ this ->config ->getAppValue (Application::APPNAME , 'term_uuid ' );
32+
33+ return [
34+ 'terms_of_service ' => [
35+ 'enabled ' => true ,
36+ 'term_uuid ' => $ termId ,
37+ ],
38+ ];
39+ }
40+ }
Original file line number Diff line number Diff line change 8888 }
8989 }
9090 },
91+ "PublicCapabilities" : {
92+ "type" : " object" ,
93+ "required" : [
94+ " terms_of_service"
95+ ],
96+ "properties" : {
97+ "terms_of_service" : {
98+ "type" : " object" ,
99+ "required" : [
100+ " enabled" ,
101+ " term_uuid"
102+ ],
103+ "properties" : {
104+ "enabled" : {
105+ "type" : " boolean" ,
106+ "enum" : [
107+ true
108+ ]
109+ },
110+ "term_uuid" : {
111+ "type" : " string"
112+ }
113+ }
114+ }
115+ }
116+ },
91117 "Terms" : {
92118 "type" : " object" ,
93119 "required" : [
Original file line number Diff line number Diff line change 8888 }
8989 }
9090 },
91+ "PublicCapabilities" : {
92+ "type" : " object" ,
93+ "required" : [
94+ " terms_of_service"
95+ ],
96+ "properties" : {
97+ "terms_of_service" : {
98+ "type" : " object" ,
99+ "required" : [
100+ " enabled" ,
101+ " term_uuid"
102+ ],
103+ "properties" : {
104+ "enabled" : {
105+ "type" : " boolean" ,
106+ "enum" : [
107+ true
108+ ]
109+ },
110+ "term_uuid" : {
111+ "type" : " string"
112+ }
113+ }
114+ }
115+ }
116+ },
91117 "Terms" : {
92118 "type" : " object" ,
93119 "required" : [
Original file line number Diff line number Diff line change 4444 }
4545 }
4646 },
47+ "PublicCapabilities" : {
48+ "type" : " object" ,
49+ "required" : [
50+ " terms_of_service"
51+ ],
52+ "properties" : {
53+ "terms_of_service" : {
54+ "type" : " object" ,
55+ "required" : [
56+ " enabled" ,
57+ " term_uuid"
58+ ],
59+ "properties" : {
60+ "enabled" : {
61+ "type" : " boolean" ,
62+ "enum" : [
63+ true
64+ ]
65+ },
66+ "term_uuid" : {
67+ "type" : " string"
68+ }
69+ }
70+ }
71+ }
72+ },
4773 "Terms" : {
4874 "type" : " object" ,
4975 "required" : [
You can’t perform that action at this time.
0 commit comments