Prevent Guest Users from Creating Large Tables
If you decide to allow guest user access on your system, you may wish to restrict guest users from creating large tables, and thus prevent guest users from accessing large table mode.
To prevent guest users from creating large tables, you need to edit <tomcat_home>\webapps\webapi\WEB-INF\data\.repository\RulesEngine.xml
Open the file in a text editor.
Make a backup copy of this file before making any changes.
Locate the following section (which is commented out by default):
XML<!-- <rules:EditRule name="GuestUserCellLimitRule" applicableOperations="all" implClassName="au.com.str.webapi.services.database.manager.rules.impl.GuestUserCellLimitRule"> <rules:impl-class-init> <rules:init-param name="limit" value="200"/> </rules:impl-class-init> </rules:EditRule> -->
Remove the comments around the rule:
XML<rules:EditRule name="GuestUserCellLimitRule" applicableOperations="all" implClassName="au.com.str.webapi.services.database.manager.rules.impl.GuestUserCellLimitRule"> <rules:impl-class-init> <rules:init-param name="limit" value="200"/> </rules:impl-class-init> </rules:EditRule>
(Optionally) change the value of the limit parameter to the maximum cell count you want to allow for guest users (the default is 200). For example:
XML<rules:impl-class-init> <rules:init-param name="limit" value="300"/> </rules:impl-class-init>
If you want to prevent guest users from accessing large table mode, make sure that you set this limit below the large table mode thresholds you set in CubeCatalog.xml (see Configure Settings for Large Tables for more details).
Locate the following section of the file:
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="DemographicVariablesRule"/> <rules:rule-name name="TableCellsNumberRule"/>
Activate the rule, by removing the comments from around the
<rules:rule-name name="GuestUserCellLimitRule"/>
line.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="DemographicVariablesRule"/> <rules:rule-name name="TableCellsNumberRule"/>
- Save your changes to the file.
- Restart Tomcat or the SuperWEB2 service.
Optional Step: Edit the Message Displayed to Guest Users
As an optional additional step, you can modify the text of the error message that is displayed if a guest user tries to create a table above this threshold.
The default error message is:
To change the message, you need to edit <tomcat_home>\webapps\webapi\WEB-INF\classes\CDataOnlineEditRules.properties
There may be multiple copies of this file for different languages and locales, with names like CDataOnlineEditRules_de.properties and CDataOnlineEditRules_ru.properties. Each one contains the text used for different languages. Depending on which languages are in use on your deployment, you may need to make these changes in multiple versions of the file. The properties file that is used will depend on the language settings in the end user's web browser, the set of supported locales defined in the faces-config.xml configuration file, and the language selected by the user from the drop-down list. See Multilingual and Localisation Support for more information about localisation and how SuperWEB2 uses the properties files.
Open the file in a text editor.
Make a backup copy of this file before making any changes.
Locate the following line:
TEXTGuestLimitCellLimiteExceeded=Table too large for guest mode.
Change the text to your preferred error message. For example:
TEXTGuestLimitCellLimiteExceeded=Table too large for guest mode. Please login to your account to create large tables.
- Save your changes and restart Tomcat or the SuperWEB2 service.