About this task
The features.xml file specifies which user roles have access to a menu group and each item in the group.
Procedure
-
In an ASCII text editor, create a
configuration
features.xml file in the TomcatHome/lib/extensions/UniqueDirectoryName/config
directory.
Where, TomcatHome is
the directory in which the Tomcat servlet engine software is installed and
UniqueDirectoryName is the directory defined in Defining a unique extensions directory. The default is /opt/Tomcat/tomcat.
-
Create the basic template for
features.xml by adding the following tags:
<?xml version="1.0" encoding="UTF-8"?>
<features
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="features.xsd">
</features>
-
For each menu group to be defined in
configuration menu.xml, add the <category> and
</category> tags just before the </features> tag.
 | Note: |
|
For each new menu group defined in the menu.xml configuration
file, you need to define the <category> and </category> tags in the
features.xml
file.
|
- For each <category> tag added, specify the following attributes:
| Attributes |
Example |
Description |
| name=”groupTag”, where groupTag is the identifier defined for the menu group in the menu.xml configuration file. |
Specify name=”newMenuGroupIdentifier” |
The identifier of the menu group defined in the configuration menu.xml file. |
- Specify a <feature> tag for each new menu item after the <category> and before the corresponding </category> tags.
 | Note: |
| For each new menu item defined in the menu.xml configuration file, you need to define a <feature> tag within the corresponding <category> tag in the features.xml file. |
- For each <feature> tag added, specify the following attributes:
| Attributes |
Example |
Description |
| name=”itemTag”, where itemTag is the identifier defined for the menu item in the menu.xml configuration file. |
Specify name=”newMenuItemIdentifier”. |
The identifier of the menu item defined in the configuration menu.xml file. |
allow=”roles”, where roles
is a combination of any of the following roles separated by commas:
-
administration
-
maintenance
-
operations
-
usermanager
-
auditor
|
To define that this menu group is accessible only to the administrator and user manager roles , specify allow= ”administration, usermanager”. |
This attribute defines the roles that have permission to view this menu group. |
 | Note: |
| Ensure that any user role specified for a menu item is also specified for the entire group. |
-
Ensure each of the new <feature>
tags have a corresponding</feature> tag.
- Save and close the file.
Example
For example, if you have a group called myMenuGroup with menu items myUsersItem, myAdminItem, and myUserMgrItem, and you want to
specify the following:
Users with any user role can see the myMenuGroup and myUsersItem groups.
Only the users with the Administration user role can see the myAdminItem group.
Users with the User Manager user role can see the myUserMgrItem group.
See the following example:
<?xml version="1.0" encoding="UTF-8"?>
<features
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="feature.xsd">
<category name="myMenuGroup"
<feature name="myUsersItem" allow="administration,operations,maintenance,auditor,usermanager">
</feature>
<feature name="myAdminItem" allow="administration"/>
</feature>
<feature name="myUserMgrItem" allow="administrator, usermanager"/>
</feature>
</category>
</features>