0 Replies Latest reply on Aug 25, 2009 11:02 AM by Juan Ignacio Sánchez Lara

    Avoiding verbose rules

    Juan Ignacio Sánchez Lara Apprentice

      I'm using Drools to perform security authorization checks at my application. I'm doing something like this:

      global User currentUser
      rule PersonFromTheSameCountry
          modify: PermissionCheck(target == person, action == "modify")

      This works perfectly when nothing is null, but, for example, if the current user hasn't a Country assigned, it fails because of the nullity. I know I can workaround this with additional checks:

      eval(currentUser.getCountry() != null)

      But this becomes too verbose when there're three or more entities. Is there any other way to express this?