1.1 --- a/imiptools/data.py Thu May 12 23:05:48 2016 +0200
1.2 +++ b/imiptools/data.py Thu May 12 23:15:18 2016 +0200
1.3 @@ -968,6 +968,28 @@
1.4
1.5 return is_same_sequence and ignore_dtstamp or not is_old_sequence
1.6
1.7 +def check_delegation(attendee_map, attendee, attendee_attr):
1.8 +
1.9 + """
1.10 + Using the 'attendee_map', check the attributes for the given 'attendee'
1.11 + provided as 'attendee_attr', following the delegation chain back to the
1.12 + delegator and forward again to yield the delegate identity. Return
1.13 + whether this identity is the given 'attendee', providing the delegator
1.14 + identity; otherwise return None.
1.15 + """
1.16 +
1.17 + # The recipient should have a reference to the delegator.
1.18 +
1.19 + delegated_from = attendee_attr and attendee_attr.get("DELEGATED-FROM")
1.20 + delegated_from = delegated_from and delegated_from[0]
1.21 + delegator = delegated_from and attendee_map.get(delegated_from)
1.22 +
1.23 + # The delegator should have a reference to the recipient.
1.24 +
1.25 + delegated_to = delegator and delegator.get("DELEGATED-TO")
1.26 + delegated_to = delegated_to and delegated_to[0]
1.27 + return delegated_to == attendee and delegated_from or None
1.28 +
1.29 def get_periods(obj, tzid, end=None, inclusive=False):
1.30
1.31 """