Limits Application
Enforce some limits on an XWiki instance: number of users, number of wikis, etc... |
Type | JAR |
Category | Application |
Developed by | |
Active Installs | 3 |
Rating | |
License | GNU Lesser General Public License 2.1 |
Table of contents
Description
Use-case: host an XWiki Instance for someone else and add some restrictions to save your resources.
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.
Configuration
You need to create a file in the /etc/xwiki/limits.xml location on the server.
This file should look like this one:
<number-of-users>42</number-of-users>
<number-of-wikis>21</number-of-wikis>
<groups>
<limit group="AdminGroup">10</limit>
<limit group="SomeGroup">15</limit>
</groups>
</limits>
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.
URL | HTTP Method | Action |
---|---|---|
http://yourWikiInstance/xwiki/rest/limits | GET | Returns the current limits in a JSON document. |
http://yourWikiInstance/xwiki/rest/limits | POST | Reload the limits from the configuration file. |
Examples:
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
}
Developers
Script Services
Method | Description | Since |
---|---|---|
$services.limits.userLimit | Get the maximum number of users | |
$services.limits.wikisLimit | Get the maximum number of wikis | |
$services.limits.userCount | Get the current number of users ( | )|
$services.limits.groupLimits | Return a map of groups with the corresponding limit | |
$services.limits.reloadConfiguration() | Reload the configuration | |
$services.limits.customLimits | Return a map of custom limits (see Custom Limits) |
Template
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:
<!-- [...] -->
<custom>
<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>
</custom>
</limits>
Limits can have 3 types:
date | A date, with the yyyy-MM-dd HH:mm format. |
---|---|
long | A long integer. |
string | 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
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
v2.1.7
The following translations have been updated with this release:
v2.1.6
The following translations have been updated with this release:
v2.1.5
The following translations have been updated with this release:
v2.1.4
The following translations have been updated with this release:
v2.1.3
v2.1.2
v2.1.1
v2.1
v2.0
v1.2.2
v1.2.1
v1.2
v1.1
Dependencies
Dependencies for this extension (org.xwiki.contrib:application-limits-api 2.1.7):
- 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