It think that I've found 2 bugs in ejb-jar.xml.vsl for the Hibernate Catridge that come to the ligth when assigning Roles to a ServiceBean operation.

N� 1

If I assign Roles to a ServiceBean Operation but NONE for the ServiceBean itself I get this result in my method permision

        <method-permission>
            <description><![CDATA[Create method security constraint]]></description>
            <unchecked/>
            <method>
              <description><![CDATA[Creates the Servicio Session EJB]]></description>
              <ejb-name>Servicio</ejb-name>
              <method-intf>LocalHome</method-intf>
              <method-name>create</method-name>
          </method>
        </method-permission>

And because I'm using a Security Realm I get an error when invoking to the ejb create method.

If I assign Roles to a ServiceBean Operation and ONE for the ServiceBean itself all roles are populated in the <method-permision>

        <method-permission>
            <description><![CDATA[Create method security constraint]]></description>
            <role-name>ProveedorLista</role-name>          // Role assigned to the ServiceBean operations
            <role-name>ProveedorAlta</role-name>           // Role assigned to the ServiceBean operations
            <role-name>ProveedorHome</role-name>         // Role assigned to the ServiceBean itself
            <role-name>ProveedorModifica</role-name>   // Role assigned to the ServiceBean operations
            <method>
              <description><![CDATA[Creates the Servicio Session EJB]]></description>
              <ejb-name>Servicio</ejb-name>
              <method-intf>LocalHome</method-intf>
              <method-name>create</method-name>
          </method>
        </method-permission>

This is the code in the ejb-jar.xml.vsl. that generates the previous examples. I think that the $service.roles.empty variable it's empty unless a Role is assigned to the ServiceBean itself.

#foreach ($service in $services)
        <method-permission>
            <description><![CDATA[Create method security constraint]]></description>
#if (!$ejbSecurityEnabled || $service.roles.empty)
            <unchecked/>
#else
#foreach ($role in $service.allRoles)
            <role-name>$role.name</role-name>
#end
#end

N� 2

My ServiceBean has the @andromda.ejb.viewType=remote but the <method-intf> in the ejb-jar.xml gets generated as local.

        <method-permission>
            <description><![CDATA[Create method security constraint]]></description>
            <role-name>ProveedorLista</role-name>
            <role-name>ProveedorAlta</role-name>
            <role-name>ProveedorHome</role-name>
            <role-name>ProveedorModifica</role-name>
            <method>
              <description><![CDATA[Creates the Servicio Session EJB]]></description>
              <ejb-name>Servicio</ejb-name>
              <method-intf>LocalHome</method-intf>
              <method-name>create</method-name>
          </method>
        </method-permission>


        <method-permission>
            <description><![CDATA[crearProveedor(com.abcware.Proveedor proveedor) security constraint]]></description>
            <role-name>ProveedorAlta</role-name>
            <role-name>ProveedorHome</role-name>
            <method>
                <description><![CDATA[]]></description>
                <ejb-name>Servicio</ejb-name>
                <method-intf>Local</method-intf>
                <method-name>crearProveedor</method-name>
                <method-params>
                    <method-param>com.abcware.Proveedor</method-param>
                </method-params>
            </method>
        </method-permission>

This is the code in the ejb-jar.xml.vsl. that generates the previous examples (N�2). I think that the $ejbRemoteView variable should be $service.ejbRemoteView. Changing this variable in the VSL worked for me.

            <method>
              <description><![CDATA[Creates the $service.name Session EJB]]></description>
              <ejb-name>$service.name</ejb-name>
#set ($homeInterface = "LocalHome")
#if ($ejbRemoteView)
#set ($homeInterface = "Home")
#end
              <method-intf>$homeInterface</method-intf>
              <method-name>create</method-name>
          </method>
        </method-permission>

#foreach ($operation in $service.operations)
        <method-permission>
            <description><![CDATA[$operation.signature security constraint]]></description>
#if (!$ejbSecurityEnabled || $operation.roles.empty)
            <unchecked/>
#else
#foreach ($role in $operation.roles)
            <role-name>$role.name</role-name>
#end
#end
            <method>
                <description><![CDATA[$operation.getDocumentation("", -1, false)]]></description>
                <ejb-name>$service.name</ejb-name>
#set ($interface = "Local")
#if ($ejbRemoteView)
#set ($interface = "Remote")
#end
                <method-intf>$interface</method-intf>
                <method-name>$operation.name</method-name>
#if (!$operation.arguments.empty)
                <method-params>
#foreach ($argument in $operation.arguments)
                    <method-param>$argument.type.fullyQualifiedName</method-param>
#end
                </method-params>
#end
            </method>

Are this bugs or I'm using something the wrong way?

Javier Adorno
Advisory
PricewaterhouseCoopers

Asunci�n - Paraguay
Phone : (595) 21 445 003 Ext. 1782
Fax : (595) 21 445 003 Ext 1206
Mobile: (595) 961 611213

_________________________________________________________________
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

Reply via email to