# HG changeset patch # User Paul Boddie # Date 1463142717 -7200 # Node ID 3e7784f3d9c9465eb7a3a5647dd08463332c50b2 # Parent 1bf71abd78582d481dd36e65d5be8163cd26bf69 Permit unlimited quotas and actually check quotas before considering delegation. diff -r 1bf71abd7858 -r 3e7784f3d9c9 imiptools/handlers/scheduling/quota.py --- a/imiptools/handlers/scheduling/quota.py Fri May 13 01:35:07 2016 +0200 +++ b/imiptools/handlers/scheduling/quota.py Fri May 13 14:31:57 2016 +0200 @@ -50,6 +50,11 @@ if not limit: return "DECLINED", _("You have no quota allocation for the recipient.") + # Where the quota is unlimited, accept the invitation. + + if limit == "*": + return "ACCEPTED", _("The recipient has scheduled the requested period.") + # Decline events whose durations exceed the balance. total = _get_duration(handler) @@ -186,8 +191,9 @@ def schedule_across_quota(handler, args): """ - Check the current object of the given 'handler' against the schedules - managed by the quota. + Check the current object of the given 'handler' against the individual + schedules managed by the quota. The consolidated schedules are not tested, + nor are the quotas themselves. """ _ = handler.get_translator() @@ -262,6 +268,16 @@ _ = handler.get_translator() + # First check the quota and decline any request that would exceed the quota. + + scheduled = check_quota(handler, args) + response, description = scheduled or ("DECLINED", None) + + if response == "DECLINED": + return response, description + + # Obtain the quota and organiser group details to evaluate delegation. + quota, group = _get_quota_and_group(handler, args) policy = args and (args[1:] or ["arbitrary"])[0] diff -r 1bf71abd7858 -r 3e7784f3d9c9 tests/test_resource_invitation_constraints_quota_delegation.sh --- a/tests/test_resource_invitation_constraints_quota_delegation.sh Fri May 13 01:35:07 2016 +0200 +++ b/tests/test_resource_invitation_constraints_quota_delegation.sh Fri May 13 14:31:57 2016 +0200 @@ -35,6 +35,12 @@ * all EOF +# Set a common quota. + +cat <