Currently, we can define request-map which invokes Java method, like following 
example:
<request-map uri="searchAddToCategory">
        <security https="true" auth="true"/>
        <event type="java" path="org.ofbiz.product.product.ProductSearchEvents" 
invoke="searchAddToCategory"/>
        <response name="success" type="view" value="keywordsearch"/>
        <response name="error" type="view" value="keywordsearch"/>
 </request-map>

Security element just checks, if user is Signed in or not. If you want to add 
permission check, you will have to keep adding code inside java method. And if 
developer forgets, it opens up security whole. 

We can do security check on Views, but that is too late, in the sense code is 
already executed inside the method.

In our code we have already added following additional attributes, which checks 
permissions before it executes the code.
<request-map uri="searchAddToCategory">
        <security https="true" auth="true" >
           <condition>
                        <if-has-permission permission="XYZ" action="_CREATE"/>
            </condition>
        </security>
        <event type="java" path="org.ofbiz.product.product.ProductSearchEvents" 
invoke="searchAddToCategory"/>
        <response name="success" type="view" value="keywordsearch"/>
        <response name="error" type="view" value="keywordsearch"/>
 </request-map>


I have patch for this, I am wondering if we like to add as part of feature or 
does anyone have better idea to handle. 



Reply via email to