3 Replies Latest reply on Oct 26, 2006 12:52 PM by manui

    Apply a role policy access to a portlet

    manui

      Hi JBoss world,
      I'm trying to apply a role policy in a portlet deployed in JBoss Portal v. 2.4. I want to restrict the access to my portlet depending of the role of the authenticated user (using the portal capabilities)....
      I can access to user information by using
      Map userInfo = (Map) rRequest.getInformations(); and get for example the locale variable, but not the role information....
      So I also try with the
      rRequest.isUserInRole("role") but does not work in my portlet.....
      I also try by using the descriptor using
      <policy-permission>
      <role-name>role</role-name>
      <action-name>viewrecursive</action-name>
      </policy-permission>
      </security-constraint>
      but it stil not works....
      I only want to get role information... I can program the policy inside the portlet... but I need this information....
      I'm a bit lost....
      Thanks for the attention
      Manuel Ottaviano

        • 1. Re: Apply a role policy access to a portlet
          soshah

          Manui-

          Are your roles specified in the portlet.xml and correspondingly available in the roles table in the portal.


          Can u post your portlet.xml and jboss-portlet.xml as well.


          Thanks
          Sohil

          • 2. Re: Apply a role policy access to a portlet
            manui

             

            "sohil.shah@jboss.com" wrote:
            Manui-

            Are your roles specified in the portlet.xml and correspondingly available in the roles table in the portal.


            Can u post your portlet.xml and jboss-portlet.xml as well.


            Thanks
            Sohil

            Hi Sohil in the admin panel I've inserted the role and I can view in the DB.
            my portlet.xml is:

            <portlet-app version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://java.sun.com/xml/ns/portlet"
            xmlns="http://java.sun.com/xml/ns/portlet">

            <portlet-name>I18nPortlet</portlet-name>
            <portlet-class>org.eu.myheart.portlets.I18nPortlet</portlet-class>
            <portlet-info>
            I18nPortlet
            </portlet-info>

            <mime-type>text/html</mime-type>
            <portlet-mode>VIEW</portlet-mode>


            <user-attribute>
            user.name.nickName
            </user-attribute>
            <user-attribute>
            user.business-info.online.email
            </user-attribute>
            <user-attribute>
            user.name.given
            </user-attribute>
            <user-attribute>
            user.name.family
            </user-attribute>
            <user-attribute>
            portal.user.locale
            </user-attribute>
            <user-attribute>
            portal.user.signature
            </user-attribute>
            <user-attribute>
            portal.user.last-login-date
            </user-attribute>
            </portlet-app>
            and my jboss-portlet.xml
            <portlet-app>

            <portlet-name>I18nPortlet</portlet-name>


            <service-name>UserModule</service-name>
            <service-class>org.jboss.portal.identity.UserModule</service-class>
            <service-ref>:service=Module,type=User</service-ref>

            </portlet-app>
            Question:
            1. there is a user attribute tag to obtain the role of the user??
            2. I've also declared the use of the Usermodule, how I can get the role...?
            thanks very much manuel


            • 3. Re: Apply a role policy access to a portlet
              manui

              I'm still lost... and the documentation on line about portlet specification does not help me ....
              here a interesting study...
              http://www.doc.ic.ac.uk/~mo197/portlets/thesis/portlets.php

              Does Jboss supports role policy capabilities inside a portlet instance??
              thanks very much....
              manuel