Install
Works with Drupal: ^9.3 || ^10 || ^11Using Composer to manage Drupal site dependencies
Alternative installation files
Release notes
Bug fixes
#3354964 Reaching a limit on one content type no longer returns 403 for the whole node/add page. Limit checks are now scoped to the bundle being checked, and a configuration that does not apply to the current account is left out of the decision instead of being treated as a limit of zero. Access results also carry proper cache contexts and tags.
#2923653 The Remove Row button in the limit configuration form now removes the row that was clicked instead of always removing the last one. Fixed in both the Role Limit and User Limit plugins.
#3480752 Entity types that declare no owner key no longer produce a QueryException. The owner key is read from the entity type rather than assumed, matching the bundle key handling.
#3616964 Fixed a foreach() warning raised when a limit configuration had no limit rows.
#3617574 Configuration entities no longer store NULL against schema keys declared as sequences. A post update repairs existing configurations.
Also resolved by the above
#3330822, #3508098 and #3108511 all described the same behaviour: a limit defined for one role denied entity creation to every other role, and menu links to the add form disappeared for everyone. This was the zero versus NULL problem fixed in #3354964. Roles and users that are not listed in a configuration are no longer treated as having a limit of zero, so there is no longer any need to enter -1 to exclude a role.
Behaviour change
When a single limit configuration selects more than one bundle, the limit used to apply to the total across those bundles. It now applies per bundle. This is what #3354964 asks for, but it does loosen limits on existing sites. A post update reports which configurations are affected without changing any data, so check the update output after upgrading.
API changes
The bundle and account arguments needed by the new logic could not be added to EntityLimitPluginInterface without breaking custom plugins at class load time. That interface is unchanged. The new signatures live in a separate optional EntityLimitBundleAwareInterface, and calling code falls back to the old signature for plugins that do not implement it.
This compatibility layer is temporary and is scheduled for removal in 3.1.x, at which point plugins will move to a single interface. See README.md and CHANGELOG.md for details.
Known limitations
Limits are only enforced on entity types whose creation path checks entity create access. Comments and other entity types that bypass that check are not limited yet. This is tracked in #3620956.
Upgrading
Run database updates after upgrading. Two post updates run: one repairs configurations holding NULL in a sequence key, and one reports configurations affected by the per bundle behaviour change.