2 Replies Latest reply on Apr 22, 2008 3:13 PM by Ryan Carmichael

    MembershipModule getUsers bug?

    Ryan Carmichael Newbie

      I believe that there is a bug in the getUsers function of MembershipModule. If you have a portlet (like below) using the getUsers function, then go to the admin portlet and assign a user to a role (in this example, 'testrole'), this portlet will continue to return a list of size 0 until you restart jboss. Once you restart jboss, the user you just assigned to the role will be in the list. However, if you remove that user from the list, this function will continue to return that user until (again) you restart jboss. This is using JBoss Portal 2.6.4.

      Has anyone had this problem or am I doing something fundamentally wrong? If not, I will file it on JIRA.

       @Override
       protected void doView(RenderRequest request, RenderResponse response)
       throws PortletException, PortletSecurityException, IOException {
       response.setContentType("text/html");
       response.getWriter().println("Testing membershipmodule");
      
       try {
       InitialContext ic = new InitialContext();
       TransactionManager tm = (TransactionManager)ic.lookup("java:/TransactionManager");
       MembershipModule mm = (MembershipModule)ic.lookup("java:portal/MembershipModule");
       RoleModule roleMod = (RoleModule)ic.lookup("java:portal/RoleModule");
      
       tm.begin();
      
       Set<User> users = mm.getUsers(roleMod.findRoleByName("testrole"));
      
       for (User user : users) {
       System.out.println("user=" + user.getUserName());
       }
      
       tm.commit();
       } catch (Exception ex) {
       ex.printStackTrace();
       }
       }
      


      - Ryan