Add grants from one decision, making room fairly instead of refusing
(kehto/web#513). Each napplet (permissionRuleSubject) holds at most
maxGrantsPerPrincipal grants, so one napplet can't fill the shared table.
To make room it evicts only session grants, oldest first: first the same
napplet's own, then, if the table is still full, the napplet holding the most
grants. persistent decisions are never evicted silently, and once grants
are never evicted because the operation that earned them may be about to
consume them. Grants are immutable snapshots, so "oldest" is insertion order:
re-approving a scope re-inserts it. Throws the putPermissionGrant limit
RangeError when only persistent or once grants are left to evict.
Add grants from one decision, making room fairly instead of refusing (kehto/web#513). Each napplet (
permissionRuleSubject) holds at mostmaxGrantsPerPrincipalgrants, so one napplet can't fill the shared table.To make room it evicts only
sessiongrants, oldest first: first the same napplet's own, then, if the table is still full, the napplet holding the most grants.persistentdecisions are never evicted silently, andoncegrants are never evicted because the operation that earned them may be about to consume them. Grants are immutable snapshots, so "oldest" is insertion order: re-approving a scope re-inserts it. Throws theputPermissionGrantlimitRangeErrorwhen only persistent or once grants are left to evict.