In addition, here is the code I use for setting the roles (in
preferencesAction). Its coupled to a checkbox. Preferences is an embedded
object in User stating his preferences (bit fields)

      // set roles according to preferences
      if (user.getPreferences().getWantsDogs() == true &&
!getRequest().isUserInRole(Constants.DOGS_ROLE)) {
        user.addRole(roleManager.getRole(Constants.DOGS_ROLE));
      } else if (user.getPreferences().getWantsDogs() == false &&
getRequest().isUserInRole(Constants.DOGS_ROLE)){
        //remove dogs role from user
        user.removeRole(roleManager.getRole(Constants.DOGS_ROLE));
      }

      userManager.saveUser(user);    // save the related user and his
preferences
-- 
View this message in context: 
http://www.nabble.com/extension-of-appfuse-roles-not-testing-correctly-tp25491920s2369p25491930.html
Sent from the AppFuse - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to