1.1 --- a/imiptools/handlers/scheduling/quota.py Fri May 13 01:35:07 2016 +0200
1.2 +++ b/imiptools/handlers/scheduling/quota.py Fri May 13 14:31:57 2016 +0200
1.3 @@ -50,6 +50,11 @@
1.4 if not limit:
1.5 return "DECLINED", _("You have no quota allocation for the recipient.")
1.6
1.7 + # Where the quota is unlimited, accept the invitation.
1.8 +
1.9 + if limit == "*":
1.10 + return "ACCEPTED", _("The recipient has scheduled the requested period.")
1.11 +
1.12 # Decline events whose durations exceed the balance.
1.13
1.14 total = _get_duration(handler)
1.15 @@ -186,8 +191,9 @@
1.16 def schedule_across_quota(handler, args):
1.17
1.18 """
1.19 - Check the current object of the given 'handler' against the schedules
1.20 - managed by the quota.
1.21 + Check the current object of the given 'handler' against the individual
1.22 + schedules managed by the quota. The consolidated schedules are not tested,
1.23 + nor are the quotas themselves.
1.24 """
1.25
1.26 _ = handler.get_translator()
1.27 @@ -262,6 +268,16 @@
1.28
1.29 _ = handler.get_translator()
1.30
1.31 + # First check the quota and decline any request that would exceed the quota.
1.32 +
1.33 + scheduled = check_quota(handler, args)
1.34 + response, description = scheduled or ("DECLINED", None)
1.35 +
1.36 + if response == "DECLINED":
1.37 + return response, description
1.38 +
1.39 + # Obtain the quota and organiser group details to evaluate delegation.
1.40 +
1.41 quota, group = _get_quota_and_group(handler, args)
1.42 policy = args and (args[1:] or ["arbitrary"])[0]
1.43
2.1 --- a/tests/test_resource_invitation_constraints_quota_delegation.sh Fri May 13 01:35:07 2016 +0200
2.2 +++ b/tests/test_resource_invitation_constraints_quota_delegation.sh Fri May 13 14:31:57 2016 +0200
2.3 @@ -35,6 +35,12 @@
2.4 * all
2.5 EOF
2.6
2.7 +# Set a common quota.
2.8 +
2.9 +cat <<EOF | "$SET_QUOTA_LIMITS" "$QUOTA" $SET_QUOTA_LIMITS_ARGS
2.10 +all *
2.11 +EOF
2.12 +
2.13 # Allow cars to delegate to each other.
2.14
2.15 cat <<EOF | "$SET_DELEGATES" "$QUOTA" $SET_DELEGATES_ARGS