summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <mollekopf@kolabsys.com>2021-11-30 11:56:32 +0100
committerChristian Mollekopf <mollekopf@kolabsys.com>2021-11-30 11:56:32 +0100
commitfded617fb03eda291e26cc1c448c6ac0f73914a6 (patch)
tree5fd2c44bdc13caf9dfd6439d1375ccabc8955db7
parent9a2ac45a5331c22d90561e3e12fbddcef7a3a615 (diff)
downloadpykolab-dev/resourcemanagement.tar.gz
ACT_STORE_AND_NOTIFY policydev/resourcemanagement
Set the status to NEEDS_ACTION and don't send out an immediate reply to the organizer.
-rw-r--r--wallace/module_resources.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/wallace/module_resources.py b/wallace/module_resources.py
index 394ff64..d39ed5a 100644
--- a/wallace/module_resources.py
+++ b/wallace/module_resources.py
@@ -59,8 +59,10 @@ ACT_MANUAL = 1
ACT_ACCEPT = 2
ACT_REJECT = 8
ACT_TENTATIVE = 16
+ACT_STORE = 32
ACT_ACCEPT_AND_NOTIFY = ACT_ACCEPT + COND_NOTIFY
ACT_TENTATIVE_AND_NOTIFY = ACT_TENTATIVE + COND_NOTIFY
+ACT_STORE_AND_NOTIFY = ACT_STORE + COND_NOTIFY
# noqa: E241
policy_name_map = {
@@ -68,7 +70,8 @@ policy_name_map = {
'ACT_ACCEPT': ACT_ACCEPT, # noqa: E241
'ACT_REJECT': ACT_REJECT, # noqa: E241
'ACT_ACCEPT_AND_NOTIFY': ACT_ACCEPT_AND_NOTIFY,
- 'ACT_TENTATIVE_AND_NOTIFY': ACT_TENTATIVE_AND_NOTIFY
+ 'ACT_TENTATIVE_AND_NOTIFY': ACT_TENTATIVE_AND_NOTIFY,
+ 'ACT_STORE_AND_NOTIFY': ACT_STORE_AND_NOTIFY
}
# pylint: disable=invalid-name
@@ -1034,11 +1037,13 @@ def accept_reservation_request(
):
"""
Accepts the given iTip event by booking it into the resource's
- calendar. Then set the attendee status of the given resource to
- ACCEPTED/TENTATIVE and sends an iTip reply message to the organizer.
+ calendar. Then, depending on the policy, set the attendee status of the given resource to
+ ACCEPTED/TENTATIVE and send an iTip reply message to the organizer, or set the status to
+ NEEDS-ACTION and don't send a reply to the organizer.
"""
owner = get_resource_owner(resource)
confirmation_required = False
+ do_send_response = True
partstat = 'ACCEPTED'
if not confirmed and owner:
@@ -1054,6 +1059,12 @@ def accept_reservation_request(
break
if policy & ACT_TENTATIVE:
partstat = 'TENTATIVE'
+ break
+ if policy & ACT_STORE:
+ partstat = 'NEEDS-ACTION'
+ # Do not send an immediate response to the organizer
+ do_send_response = False
+ break
itip_event['xml'].set_transparency(False)
itip_event['xml'].set_attendee_participant_status(
@@ -1068,8 +1079,7 @@ def accept_reservation_request(
level=8
)
- # Only send a response back to the organizer if this is a confirmation from the resource owner.
- if saved and confirmed:
+ if saved and do_send_response:
send_response(delegator['mail'] if delegator else resource['mail'], itip_event, owner)
if owner and confirmation_required: