0 Replies Latest reply on Jul 6, 2008 11:37 AM by Mehdi Ghermezkon

    JBoss Rules Not worked Help me

    Mehdi Ghermezkon Newbie

      hi everyone
      in my project , i'm define rules with jboss rules in rules-file and when run project two message

      [Contexts] starting up: org.jboss.seam.security.identity
      [RuleBase] parsing rules: /security.drl

      is shown in console window(eclipse 3.3)(every things is fine)

      but rules not worked in our session bean and not effected !!
      //********************************************
      components.xml :

      <?xml version="1.0" encoding="UTF-8"?>
      <components xmlns="http://jboss.com/products/seam/components"
       xmlns:core="http://jboss.com/products/seam/core"
       xmlns:persistence="http://jboss.com/products/seam/persistence"
       xmlns:drools="http://jboss.com/products/seam/drools"
       xmlns:bpm="http://jboss.com/products/seam/bpm"
       xmlns:security="http://jboss.com/products/seam/security"
       xmlns:mail="http://jboss.com/products/seam/mail"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation=
       "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.0.xsd
       http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.0.xsd
       http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.0.xsd
       http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.0.xsd
       http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.0.xsd
       http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.0.xsd
       http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.0.xsd">
      
       <core:init debug="true" jndi-pattern="@jndiPattern@"/>
      
       <core:manager concurrent-request-timeout="500"
       conversation-timeout="120000"
       conversation-id-parameter="cid"/>
      
       <persistence:managed-persistence-context name="entityManager"
       auto-create="true"
       persistence-unit-jndi-name="java:/EhyaEntityManagerFactory"/>
      
       <drools:rule-base name="securityRules">
       <drools:rule-files>
       <value>/security.drl</value>
       </drools:rule-files>
       </drools:rule-base>
      
       <security:identity authenticate-method="#{authenticator.authenticate}"
       security-rules="#{securityRules}"/>
      
       <event type="org.jboss.seam.notLoggedIn">
       <action execute="#{redirect.captureCurrentView}"/>
       </event>
       <event type="org.jboss.seam.postAuthenticate">
       <action execute="#{redirect.returnToCapturedView}"/>
       </event>
      
      </components>
      

      //***************************************
      rules-file (security.drl):
      package MyPermissions;
      
      import java.security.Principal;
      
      import org.jboss.seam.security.PermissionCheck;
      import org.jboss.seam.security.Role;
      
      rule testMyRule
      no-loop
      activation-group "permissions"
      when
       c: PermissionCheck(name == "rolesController", action == "merge", granted == false)
       Role(name == 'user')
      then
       c.grant();
      end;
      

      //************************************************
      session bean :
      @Stateful
      @Name("rolesController")
      @Scope(ScopeType.SESSION)
      public class RolesSessionBean implements RolesController {
       public String merge(){
       //Method Code
       }
      }
      

      //************************************************
      i'm use :
      eclipse 3.3
      richfaces ui 3.2.1.GA
      Jboss Tooles 2.0.1GA
      Jboss AS 4.2.2.GA
      Jboss Seam 2.0.0.GA

      anyone can help me how to solved problem??(Sorry for english)
      it's very important for me.
      thanks