lockEnforce some limits on an XWiki instance: number of users, number of wikis, etc...
Developed by

Guillaume Delhumeau

Active Installs0
0 Votes
LicenseGNU Lesser General Public License 2.1
Installable with the Extension Manager


Use-case: host an XWiki Instance for someone else and add some restrictions to save your resources.

This applications is an effort to prevent fair users to exceed some restrictions. However, it's still technically possible to go beyond them as soon as the user can write components, or install an extension made for this purpose.

That's why we encourage you to enforce the restrictions with an external service that regularly check the state of the XWiki instance and punish the users who deliberately exceed the limits.

Supported limits

Users Limit

You can set the maximum number of users that the XWiki Instance is allowed to support. Any additional user will not be created.

Some elements in the UI will show the users what are the limits:

Wikis Limit

You can set the maximum number of wikis that the XWiki Instance is allowed to support. Any additional wiki will not be created.

Groups Limit

It is possible to set a limit for the number of members inside some groups.

Right now, there is no UI to show this limit to the user. When she adds a member on a group that is already full, all she will see is an error message.


You need to create a file in the /etc/xwiki/limits.xml location on the server.

This file should look like this one:

   <limit group="AdminGroup">10</limit>
   <limit group="SomeGroup">15</limit>
The configuration file MUST exists and be readable. Otherwise your XWiki instance will not run!

Note: you can limit any group you want, but it works only for global groups (ie from the main wiki).

REST Service (reload the limits)

If you change the limits from the XML file, you need to tell the application that the limits should be reloaded. There is a simple REST service to do so. 

URLHTTP MethodAction
http://yourWikiInstance/xwiki/rest/limitsGETReturns the current limits in a JSON document.
http://yourWikiInstance/xwiki/rest/limitsPOSTReload the limits from the configuration file.


## Reload the limits:
curl -X POST http://localhost:8080/xwiki/rest/limits

## Display the limits:
curl http://localhost:8080/xwiki/rest/limits
 "groupsLimits" : {
   "xwiki:XWiki.SomeGroup" : 20
 "totalNumberOfUsersLimit" : 8,
 "wikisNumberLimit" : 3


Script Services

$services.limits.userLimitGet the maximum number of users
$services.limits.wikisLimitGet the maximum number of wikis
$services.limits.userCountGet the current number of users (This operation is costly)
$services.limits.groupLimitsReturn a map of groups with the corresponding limit
$services.limits.reloadConfiguration()Reload the configuration
$services.limits.customLimitsReturn a map of custom limits (see Custom Limits)1.2


The template used to display the UI extensions is located inside the JAR module.

It could easily be overwritten by creating a custom limits-uix.vm in your skin directory, or using the Skin Application.

Custom Limits

Since 1.2, the application gives you the ability to handle your own limits and to take advantage of the existing configuration mechanism (the XML file, the Rest Service and the Script Service).

All you need is to declare your custom limits in the configuration file, in the <custom> element. Example:

 <!-- [...] -->
   <limit name="end-of-service" type="date">2016-09-19 16:50</limit>
   <limit name="number-of-pages" type="long">3600</limit>
   <limit name="group-prefix" type="string">CustomValue</limit>

Limits can have 3 types:

dateA date, with the yyyy-MM-dd HH:mm format.
longA long integer.
stringSince 2.0 A string value, for advanced use-cases.

Then you can use the script service to get your limits, or the LimitsConfiguration component in your Java code.

Prerequisites & Installation Instructions

This application can be installed with the Extension Manager. However, if you install it this way, then any administrator will be able to uninstall it. If you wish to prevent this (and this the recommended way), you should instead install it as a core Extension (since Core Extensions can't be uninstalled) by copying the application-limits-api.jar in the WEB-INF/lib directory of the XWiki webapp.

Since version 1.1, the UI is contained in the application JAR. So all you have to do is to install this JAR.

Release Notes


XWiki >= 8.4 is now required


  • Closed LIMITS-9 Limits message is wrongly displayed after a page deletion


  • Closed LIMITS-8 Impossible to install Limits Application with Extension Manager


  • Closed LIMITS-7 Add the ability to store custom limits


  • Closed LIMITS-4 Bad namespace for the application
  • Closed LIMITS-5 Refactor the application to only have a JAR (no XAR anymore)


Dependencies for this extension (org.xwiki.contrib:application-limits-api 2.0):

  • org.xwiki.commons:xwiki-commons-component-default 8.4
  • org.xwiki.platform:xwiki-platform-model 8.4
  • org.xwiki.platform:xwiki-platform-oldcore 8.4
  • org.xwiki.platform:xwiki-platform-wiki-creationjob 8.4
  • org.xwiki.platform:xwiki-platform-rest-server 8.4
  • org.xwiki.platform:xwiki-platform-uiextension-api 8.4
Created by Guillaume Delhumeau on 2016/09/12 15:21

Get Connected