[rules-users] New functionality not working?
Andrew Robinson
andrew.rw.robinson at gmail.com
Tue Dec 18 12:52:29 EST 2007
Okay got the from working in a new rule (one rule to check the admin
roles, one to check the permissions). Is there a better way to do
this?
-Andrew
On Dec 18, 2007 10:03 AM, Andrew Robinson <andrew.rw.robinson at gmail.com> wrote:
> Quote from the site:
>
> Disjunctive field constraints connectives could also be used and would
> not result in multiple rule generation.
> Person( eyeColour == "blue"||"green" )
>
> Any idea on why the "from" is not correct?
> $rt: ResourceType( )
> $perm: ResourceTypePermission( accessType != AccessType.READ )
> from $rt.permissions
> Role(id == $perm.role.id)
>
> From syntax in the docs:
> http://downloads.jboss.com/drools/docs/4.0.3.15993.GA/html_single/index.html#d0e3867
>
>
> On Dec 18, 2007 3:59 AM, Edson Tirelli <tirelli at post.com> wrote:
> >
> > Correct is either:
> >
> >
> > Role(name == "christws-admin" || == "site-admin" || ==
> > "resource-type-admin")
> >
> > Or:
> >
> > Role(name in ( "christws-admin", "site-admin", "resource-type-admin") )
> >
> > Where in the docs it says that the syntax you used is correct?
> >
> > []s
> > Edson
> >
> > 2007/12/18, Andrew Robinson <andrew.rw.robinson at gmail.com >:
> > >
> > >
> > >
> > > I upgraed my jboss seam and got the new drools-core and
> > > drools-compiler installed. In my maven pom.xml, I am loading 4.0.3 of
> > > each. My rule is not loading though.
> > >
> > > Rule from "entity-rules.drl":
> > >
> > > // Resource type (this is line 16)
> > > rule "Resource type changes"
> > > no-loop
> > > activation-group "permissions"
> > > when
> > > check: PermissionCheck(name == "com.christws.entities.ResourceType",
> > > granted == false)
> > > (
> > > Role(name == "christws-admin" || "site-admin" ||
> > "resource-type-admin")
> > > or
> > > (
> > > $rt: ResourceType( )
> > > $perm: ResourceTypePermission( accessType != AccessType.READ )
> > > from $rt.permissions
> > > Role(id == $perm.role.id)
> > > )
> > > )
> > > then
> > > check.grant ();
> > > end;
> > >
> > > I am getting parsing errors with the Role line due to the ""||""||""
> > > syntax and with the $perm line because of the "from". According to
> > > [1], these should work.
> > >
> > > 23:06:49,082 ERROR [RuleBase] errors parsing rules in:
> > > /META-INF/entity-rules.drl
> > > 23:06:49,083 ERROR [RuleBase] unknown:23:37 Unexpected token
> > > '"site-admin"' (/META-INF/entity-rules.drl)
> > > 23:06:49,083 ERROR [RuleBase] unknown:23:37 Unexpected token
> > > '"site-admin"' (/META-INF/entity-rules.drl)
> > > 23:06:49,083 ERROR [RuleBase] unknown:23:53 Unexpected token
> > > '"resource-type-admin"' (/META-INF/entity- rules.drl)
> > > 23:06:49,083 ERROR [RuleBase] unknown:27:6 mismatched token:
> > > [@170,739:743='$perm',<7>,27:6]; expecting type RIGHT_PAREN
> > > (/META-INF/entity-rules.drl)
> > > 23:06:49,083 ERROR [RuleBase] unknown:29:4 mismatched token:
> > > [@205,859:859=')',<12>,29:4]; expecting type THEN
> > > (/META-INF/entity-rules.drl)
> > >
> > > What am I doing wrong? I am trying to see if the user has one of the 3
> > > admin roles or has a role whose permission is update or delete (not
> > > read) (ResourceType has List<ResourceTypePermission> getPermissions()
> > > which has getAccessType() and getRole()).
> > >
> > > Thanks,
> > > Andrew
> > >
> > > [1]
> > http://downloads.jboss.com/drools/docs/4.0.3.15993.GA/html_single/index.html
> > > _______________________________________________
> > > rules-users mailing list
> > > rules-users at lists.jboss.org
> > > https://lists.jboss.org/mailman/listinfo/rules-users
> > >
> >
> >
> >
> > --
> > Edson Tirelli
> > JBoss Drools Core Development
> > Office: +55 11 3529-6000
> > Mobile: +55 11 9287-5646
> > JBoss, a division of Red Hat @ www.jboss.com
> > _______________________________________________
> > rules-users mailing list
> > rules-users at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/rules-users
> >
> >
>
More information about the rules-users
mailing list