I'm having difficulty writing this rule.
Background information:
A User can have a supervisor but it's not required.
When viewing User information I want to verify that the logged in user is
either the current user or the currentUser's supervisor but I throw an
exception when the supervisor object is null on the currentUser.
The target is the User being viewed and I have a global object that is the
current user. How can I check to see if the supervisor exists before
evaluating if the currentUser and the supervisor are equal?
rule 'CanViewUserData'
dialect 'mvel'
when
$user : User()
$supervisor : User( ) from $user.userProfile.supervisor
$check: PermissionCheck(target == $user, action == "viewUserData")
eval(isUserMatching($user)) || eval (isUserMatching($supervisor))
then
System.out.println("The currentUser CanViewUserData");
$check.grant();
end
--
View this message in context:
http://drools-java-rules-engine.46999.n3.nabble.com/Verify-if-an-objects-...
Sent from the Drools - User mailing list archive at
Nabble.com.