7 Replies Latest reply on May 24, 2011 8:34 PM by Jason Porter

    associateGroups

    Bill Elliot Newbie

      I am trying to use the associateGroups method of RelationshipManager. But, when I execute it nothing is added to the relationship table and when I execute isAssociated right after I get back false. Am I missing something? I get the RelationshipManager object via an injection. I'm using Seam 3.0.0.

        • 1. Re: associateGroups
          Bill Elliot Newbie

          To clearify I'm trying to create a group hierarchy and am trying to associate 2 groups.

          • 2. Re: associateGroups
            Bill Elliot Newbie

            Can no one help with this problem?

            • 3. Re: associateGroups
              Jason Porter Master

              Shane is the one to take this one up. I'm not familiar with the API at all unfortunately. Is what you're trying to do backed by a database or something else? If it's a database it sounds like something isn't being persisted properly, if at all. If you can distill this into a simple test or basic app it'll help one of us less familiar the module.


              Sorry it's taken so long to get back to you, not our intention to let things slip, but every once in awhile they do. Very sorry it happened to you.

              • 4. Re: associateGroups
                Bill Elliot Newbie

                Yes this is using MySQL 5.1 and it appears the association is not being persisted. If I manually enter the table row the association is detected correctly. But, the call to associateGroups is not persisting the relationship. I have used the following code to test out this:



                package org.jboss.seam.security.examples.idmconsole.tests;
                
                import javax.inject.Inject;
                
                import org.picketlink.idm.api.Group;
                import org.picketlink.idm.api.IdentitySession;
                import org.picketlink.idm.api.PersistenceManager;
                import org.picketlink.idm.api.RelationshipManager;
                import org.picketlink.idm.common.exception.IdentityException;
                
                public class TestSecurity {
                
                        @Inject IdentitySession identitySession;
                         
                        public String testAction() throws IdentityException {
                                PersistenceManager pm = identitySession.getPersistenceManager();
                                RelationshipManager rm = identitySession.getRelationshipManager();
                                Group head = pm.findGroup("Head Office", "ORGANIZATION_UNIT");
                                Group branch = pm.findGroup("Branch Office", "ORGANIZATION_UNIT");
                                if( ! rm.isAssociated(head, branch) ) {
                                        rm.associateGroups(head, branch);
                                }
                                boolean isAssociated = rm.isAssociated(head, branch);
                                return null;
                        }
                }





                The 2 groups in the test code exist in my test DB when I run the above code. I single step through the code to verify the situation after each line and everything is as expected, except that the call to rm.associateGroups(head, branch); does not persist the association.

                • 5. Re: associateGroups
                  Jason Porter Master

                  Sounds like a bug, would you please file a JIRA?

                  • 6. Re: associateGroups
                    Bill Elliot Newbie

                    I have created this as a JIRA as SEAM-89.