Skip to content

Commit f985d09

Browse files
authored
Merge pull request #2150 from pbiering/sharing-info-bday
Sharing/show supported Actions on info
2 parents 6f2d55c + 2c15cb0 commit f985d09

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

SHARING.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ FeatureEnabledCollectionByToken=True
270270
PermittedCreateCollectionByToken=True
271271
SupportedConversions=(bday none)
272272
PermittedPropertiesOverlay=True
273-
SupportedPropertiesOverlay=(C:calendar-description ICAL:calendar-color CR:addressbook-description INF:addressbook-color D:displayname)
273+
SupportedPropertiesOverlay=(C:calendar-description ICAL:calendar-color CR:addressbook-description INF:addressbook-color D:displayname ICAL:calendar-order)
274+
SupportedActions='{'config': {'conversion_bday_summary_template': 'str', 'conversion_bday_description_template': 'str', 'conversion_bday_alarm_trigger_template': 'str', 'conversion_bday_categories': 'str', 'conversion_bday_age_max': 'int'}}'
274275
```
275276

276277
###### json->json, parsed with jq
@@ -285,9 +286,28 @@ curl -u user:$userpw --silent -H "accept: application/json" -d "" http://localho
285286
"PermittedCreateCollectionByMap": true,
286287
"FeatureEnabledCollectionByToken": true,
287288
"PermittedCreateCollectionByToken": true,
288-
"SupportedConversions": ["bday", "none"],
289+
"SupportedConversions": [
290+
"bday",
291+
"none"
292+
],
289293
"PermittedPropertiesOverlay": true,
290-
"SupportedPropertiesOverlay": ["C:calendar-description", "ICAL:calendar-color", "CR:addressbook-description", "INF:addressbook-color", "D:displayname"]
294+
"SupportedPropertiesOverlay": [
295+
"C:calendar-description",
296+
"ICAL:calendar-color",
297+
"CR:addressbook-description",
298+
"INF:addressbook-color",
299+
"D:displayname",
300+
"ICAL:calendar-order"
301+
],
302+
"SupportedActions": {
303+
"config": {
304+
"conversion_bday_summary_template": "str",
305+
"conversion_bday_description_template": "str",
306+
"conversion_bday_alarm_trigger_template": "str",
307+
"conversion_bday_categories": "str",
308+
"conversion_bday_age_max": "int"
309+
}
310+
}
291311
}
292312
```
293313

radicale/sharing/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
"SupportedConversions": list,
117117
"PermittedPropertiesOverlay": bool,
118118
"SupportedPropertiesOverlay": list,
119+
"SupportedActions": dict,
119120
}
120121

121122

@@ -185,6 +186,7 @@ def check_template_alarm_trigger(data: Any) -> str:
185186
return data
186187

187188

189+
# dict for validation of API request: create/update
188190
ACTIONS_WHITELIST: dict = {
189191
'config': {
190192
'conversion_bday_summary_template': check_template_not_empty,
@@ -195,6 +197,17 @@ def check_template_alarm_trigger(data: Any) -> str:
195197
},
196198
}
197199

200+
# dict for displaying API request: info
201+
ACTIONS_WHITELIST_INFO: dict = {
202+
'config': {
203+
'conversion_bday_summary_template': "str",
204+
'conversion_bday_description_template': "str",
205+
'conversion_bday_alarm_trigger_template': "str",
206+
'conversion_bday_categories': "str",
207+
'conversion_bday_age_max': "int",
208+
},
209+
}
210+
198211
CONVERSIONS_WHITELIST: Sequence[str] = ("bday", "none")
199212

200213

@@ -1431,6 +1444,7 @@ def post(self, environ: types.WSGIEnviron, base_prefix: str, path: str, user: st
14311444
answer['SupportedConversions'] = CONVERSIONS_WHITELIST
14321445
answer['PermittedPropertiesOverlay'] = self.permit_properties_overlay
14331446
answer['SupportedPropertiesOverlay'] = OVERLAY_PROPERTIES_WHITELIST
1447+
answer['SupportedActions'] = ACTIONS_WHITELIST_INFO
14341448

14351449
# action: TOGGLE
14361450
elif action in API_SHARE_TOGGLES_V1:

radicale/tests/test_sharing.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,7 @@ def test_sharing_api_base_with_auth(self) -> None:
425425
assert answer_dict['SupportedConversions'] == list(sharing.CONVERSIONS_WHITELIST)
426426
assert answer_dict['PermittedPropertiesOverlay'] is True
427427
assert answer_dict['SupportedPropertiesOverlay'] == list(sharing.OVERLAY_PROPERTIES_WHITELIST)
428+
assert answer_dict['SupportedActions'] == sharing.ACTIONS_WHITELIST_INFO
428429

429430
logging.info("\n*** check API hook: info/all (2)")
430431
self.configure({"sharing": {"permit_properties_overlay": "False"}})

0 commit comments

Comments
 (0)