Configure User Query Limits - SuperWEB2
You can set limits on the size of tables that users can create.
Overview of User Query Limits
- You can restrict the number of fields, rows, columns, wafers, or total cells that users can add to a table.
- The query limits apply to groups rather than individual users. If you have not already done so, you will need to organise your users into groups. See Users, Groups and Permissions for more information about this step.
- There are also some default limits that apply to all users. The defaults are designed to prevent users from creating very large tables.
- If a user belongs to multiple groups, and you set different limits for those groups, then the lower limit will apply to that user.
- If a limit is not defined for a particular group (or is defined incorrectly) then there will be no restrictions applied to that group (apart from the default limits).
- If a user loads a predefined table with more items than allowed by their limits or you have configured mandatory fields and these fields push the user over their limit, then the table will open but the user will not be able to add anything else to the table unless they remove some items to get under their configured limit.
- If a user hits one of the axis limits, then they can continue to add items to the other axes until they hit their limit on that axis too. For example if a user hits the column limit they can continue to add to the table rows until they reach the row limit.
Configure the Limits
Query limits are configured in SuperADMIN, using the cfg
command. You will not need to restart SuperWEB2 to pick up the changes you make in SuperADMIN (although if you currently have SuperWEB2 Table View open, you will need to go back to the catalogue and reopen the dataset to see any changes). This also applies to any users who currently have Table View open. They will not see the effect of your changes until they reselect the dataset from the catalogue.
In addition, you should note that any changes to users and groups are not applied until users log out and back in again. So if you have just changed group memberships (with the account
command) as part of setting up the query limits, then those changes will not be applied until users log in again.
Configure the Default Limits for All Users
The defaultQueryLimits
are active by default and apply to all users.
You can check the current settings using the following command:
> cfg global superweb2.rules.defaultQueryLimits
superweb2.rules.defaultQueryLimits :
{
"cells":10000000,
"wafers":1000,
"columns":1000000,
"rows":1000000,
"fields":10
}
These defaults will prevent any user from creating a table with more than 10,000,000 cells, 1,000 wafers, 1,000,000 columns, 1,000,000 rows or 10 fields.
You should not need to change these settings. However, if you wish to adjust the limits, you can use the following commands:
cfg global superweb2.rules.defaultQueryLimits.cells set <cells>
cfg global superweb2.rules.defaultQueryLimits.wafers set <wafers>
cfg global superweb2.rules.defaultQueryLimits.columns set <columns>
cfg global superweb2.rules.defaultQueryLimits.rows set <rows>
cfg global superweb2.rules.defaultQueryLimits.fields set <fields>
For example, if you wish to decrease the total number of cells users can include in a table to 1,000,000, you would use the following command
> cfg global superweb2.rules.defaultQueryLimits.cells set 1000000
superweb2.rules.defaultQueryLimits.cells : Updated
Configure User/Group Limits
Before starting to configure the group limits, it is a good idea to use the following command to check whether any group limits are currently defined:
cfg global superweb2.rules.groupQueryLimits
SuperWEB2 will either display the list of existing limits (if some are already defined), or display "not found".
Scenario A: No Existing Limits Defined
If there are no existing limits defined, SuperADMIN displays the message "not found":
> cfg global superweb2.rules.groupQueryLimits
superweb2.rules.groupQueryLimits : not found
To create a new set of limits for a particular group, use the following commands:
cfg global superweb2.rules.groupQueryLimits[<index>].groupId set <group_id>
cfg global superweb2.rules.groupQueryLimits[<index>].limits.fields set <fields>
cfg global superweb2.rules.groupQueryLimits[<index>].limits.cells set <cells>
cfg global superweb2.rules.groupQueryLimits[<index>].limits.rows set <rows>
cfg global superweb2.rules.groupQueryLimits[<index>].limits.columns set <columns>
cfg global superweb2.rules.groupQueryLimits[<index>].limits.wafers set <wafers>
Where:
<index>
is the index for this set of query limits. Each set of limits has a unique index number, starting from zero.<group_id>
is the ID of the group that this set of limits applies to.<fields>
,<cells>
,<rows>
,<columns>
and<wafers>
are the maximum number of each item that users belonging to this group will be allowed to add to a table.
For example, the following commands specify the limits for users who belong to a group called Guests. As this is the first set of limits we have defined it has the index value of 0.
cfg global superweb2.rules.groupQueryLimits[0].groupId set "Guests"
cfg global superweb2.rules.groupQueryLimits[0].limits.fields set 5
cfg global superweb2.rules.groupQueryLimits[0].limits.cells set 50
cfg global superweb2.rules.groupQueryLimits[0].limits.rows set 10
cfg global superweb2.rules.groupQueryLimits[0].limits.columns set 10
cfg global superweb2.rules.groupQueryLimits[0].limits.wafers set 1
In this example, any users who belong to the Guests group will not be able to create a table that contains any of the following:
- More than 5 fields.
- More than 50 cells in total.
- More than 10 rows.
- More than 10 columns.
- More than 1 wafer.
To add a second set of limits, use the same commands but increment the index value. For example:
cfg global superweb2.rules.groupQueryLimits[1].groupId set "Administrators"
cfg global superweb2.rules.groupQueryLimits[1].limits.fields set 100
cfg global superweb2.rules.groupQueryLimits[1].limits.cells set 10000
cfg global superweb2.rules.groupQueryLimits[1].limits.rows set 100
cfg global superweb2.rules.groupQueryLimits[1].limits.columns set 100
cfg global superweb2.rules.groupQueryLimits[1].limits.wafers set 10
Scenario B: Existing Limits Defined
If there are already some existing limits defined, then SuperADMIN displays the details. For example:
> cfg global superweb2.rules.groupQueryLimits
superweb2.rules.groupQueryLimits :
[
{
"limits":{
"cells":50,
"wafers":1,
"columns":10,
"rows":10,
"fields":5
},
"groupId":"Guests"
},
{
"limits":{
"cells":10000,
"wafers":10,
"columns":100,
"rows":100,
"fields":100
},
"groupId":"Administrators"
}
]
In this example there are two existing sets of limits defined, one for Guests and one for Administrators (each one is enclosed in curly brackets).
You can either add a new set of limits or update one of these existing ones:
To add a new set of limits for a third group, simply make sure that you use the next index value up. In this example, there are already two sets of limits, so to create a third one you must use the index value of 2 (because the index numbering starts at 0). For example:
CODEcfg global superweb2.rules.groupQueryLimits[2].groupId set "Managers" cfg global superweb2.rules.groupQueryLimits[2].limits.fields set 10 cfg global superweb2.rules.groupQueryLimits[2].limits.cells set 1000 cfg global superweb2.rules.groupQueryLimits[2].limits.rows set 10 cfg global superweb2.rules.groupQueryLimits[2].limits.columns set 10 cfg global superweb2.rules.groupQueryLimits[2].limits.wafers set 1
To update an existing set of limits, simply use the index value of the existing rule. For example, to change the row limit for the Guests group, use the index value of 0:
CODEcfg global superweb2.rules.groupQueryLimits[0].limits.rows set 15
When you have finished configuring the limits, you may wish to login to SuperWEB2 with a user account that belongs to the relevant group and check the limits are being applied correctly.
When a user attempts to exceed the configured limits, an error message is displayed at the top of SuperWEB2 Table View. You can configure the text displayed in this error message by editing the message strings defined in <tomcat_home>\webapps\webapi\WEB-INF\classes\CDataOnlineEditRules.properties (and the equivalent versions of this file for any other user interface languages your deployment supports).
The messages you need to update are querylimit.fields
, querylimit.cells
, querylimit.rows
, querylimit.columns
, and querylimit.wafers
.
If you decide to update these messages then you will need to restart Tomcat or SuperWEB2 to apply the change.
Deactivate User Query Limits
Query limits are applied by SuperWEB2's rules engine. The query limit rule is activated by default.
If you do not want to have any user query limits (including the default query limits) then you can turn this rule off by editing <tomcat_home>\webapps\webapi\WEB-INF\data\.repository\RulesEngine.xml in a text editor:
Locate the following section of RulesEngine.xml:
XML<rules:RulesPipe name="CDataOnlineEditRules"> <!-- <rules:rule-name name="OverrideDefaultSummationRule"/> --> <!-- <rules:rule-name name="MandatoryFieldsRule"/> --> <!-- <rules:rule-name name="DBSummationOptionsRule"/> --> <!-- <rules:rule-name name="GuestUserCellLimitRule"/> --> <!-- <rules:rule-name name="noConcatenationRule"/> --> <rules:rule-name name="GroupQueryLimitRule"/>
Add comments around the
GroupQueryLimitRule
to deactivate it:XML<rules:RulesPipe name="CDataOnlineEditRules"> <!-- <rules:rule-name name="OverrideDefaultSummationRule"/> --> <!-- <rules:rule-name name="MandatoryFieldsRule"/> --> <!-- <rules:rule-name name="DBSummationOptionsRule"/> --> <!-- <rules:rule-name name="GuestUserCellLimitRule"/> --> <!-- <rules:rule-name name="GroupQueryLimitRule"/> -->
Save your changes to the file.
Restart Tomcat or the SuperWEB2 service to apply the change to RulesEngine.xml.
This change is not recommended for production use, as it will deactivate the default query limits, in addition to the user/group specific query limits. If you just want to turn off all user/group limits, then it is better to leave the rule active in RulesEngine.xml and use the following command in SuperADMIN instead:
cfg global superweb2.rules.groupQueryLimits remove
This will remove all defined group query limits, but will leave the default limits in place.