Chapter 11. Portlet Modes
Prev |  | Next

## Chapter 11. Portlet Modes

### Julien Viet

`<julien.viet@jboss.com>`

JBoss Portal supports the standard portlet modes defined by the JSR-168 specification which are view, edit and help. In addition of that it also supports the admin portlet mode.

## 11.1. Admin Portlet Mode

The admin mode defines a mode for the portlet which allows the administration of the portlet. Access to this mode is only granted to users having an appropriate role. In order to grant admin access to a portlet, the user must have a role which grants him the admin action permission on the portlet instance. This can be done in the instance deployment descriptor or using the administation portlet of the portal.

### 11.1.1. Portlet configuration

In order to be able to use the admin mode, the portlet must declare it in the portlet deployment descriptor.

    <portlet-app>
       ...
       <portlet>
          ...
          <supports>
             <mime-type>text/html</mime-type>
             <portlet-mode>admin</portlet-mode>
          </supports>
          ...
       </portlet>
       ...
       <custom-portlet-mode>
          <name>admin</name>
       </custom-portlet-mode>
       ...
    </portlet-app>

### 11.1.2. Declarative instance security configuration

The following example shows the configuration of a portlet instance that grants the admin action permission to the Admin security role. It also grants the view action permission to all users.

    ...
    <instance>
       <instance-id>ModePortletInstance</instance-id>
       <portlet-ref>ModePortlet</portlet-ref>
       <security-constraint>
          <policy-permission>
             <action-name>admin</action-name>
             <role-name>Admin</role-name>
          </policy-permission>
          <policy-permission>
             <action-name>view</action-name>
             <unchecked/>
          </policy-permission>
       </security-constraint>
    </instance>
    ...

### 11.1.3. Instance security configuration with the administration portlet

At runtime the security configuration section of the administration portlet can be used to grant or revoke the admin access. It can be done by clicking the security action of the portlet instance and then use the security editor.

Edit the security instance configuration

Prev | Up | Next
Chapter 10. Widget Integration | Home | Chapter 12. Portal API