You could try to explain a bit more how the User class and the isUserMatching method look like.<br><br>Leo.<br><br><br><div class="gmail_quote">On Fri, Sep 10, 2010 at 11:30 PM, lnguyen <span dir="ltr">&lt;<a href="mailto:mzspdrcr@gmail.com">mzspdrcr@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br>
I&#39;m having difficulty writing this rule.<br>
<br>
Background information:<br>
A User can have a supervisor but it&#39;s not required.<br>
<br>
When viewing User information I want to verify that the logged in user is<br>
either the current user or the currentUser&#39;s supervisor but I throw an<br>
exception when the supervisor object is null on the currentUser.<br>
<br>
The target is the User being viewed and I have a global object that is the<br>
current user. How can I check to see if the supervisor exists before<br>
evaluating if the currentUser and the supervisor are equal?<br>
<br>
rule &#39;CanViewUserData&#39;<br>
dialect &#39;mvel&#39;<br>
when<br>
    $user : User()<br>
    $supervisor : User( ) from $user.userProfile.supervisor<br>
    $check: PermissionCheck(target == $user, action == &quot;viewUserData&quot;)<br>
    eval(isUserMatching($user)) || eval (isUserMatching($supervisor))<br>
then<br>
    System.out.println(&quot;The currentUser CanViewUserData&quot;);<br>
    $check.grant();<br>
end<br>
<font color="#888888"><br>
--<br>
View this message in context: <a href="http://drools-java-rules-engine.46999.n3.nabble.com/Verify-if-an-objects-attribute-exists-tp1455073p1455073.html" target="_blank">http://drools-java-rules-engine.46999.n3.nabble.com/Verify-if-an-objects-attribute-exists-tp1455073p1455073.html</a><br>

Sent from the Drools - User mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>