This content has been marked as final.
Show 2 replies
-
1. Re: Security rules for Role in document not working..
shane.bryzak Jul 5, 2007 9:50 PM (in response to tim_ph)Is the user already authenticated before you invoke addRole() in your rule? If not, then calling addRole() simply puts the role into a temporary "holding" area until authentication is successful, at which point it becomes a "real" role which will then return true for a hasRole() check.
-
2. Re: Security rules for Role in document not working..
tim_ph Jul 6, 2007 2:54 PM (in response to tim_ph)Yes, I return true in authenticate() call
public boolean authenticate() { String user = identity.getUsername(); log.info("authenticating #0", user); if ("tim".equals(user)) { //identity.addRole("admin"); assignRole(); } else { identity.addRole("user"); } return true; } public void assignRole() { administrationWorkingMemory.assertObject(identity); administrationWorkingMemory.fireAllRules(); }